diff --git a/.fernignore b/.fernignore new file mode 100644 index 0000000..084a8eb --- /dev/null +++ b/.fernignore @@ -0,0 +1 @@ +# Specify files that shouldn't be modified by Fern diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7fbf392 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +name: ci + +on: [push] + +jobs: + compile: + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up Java + id: setup-jre + uses: actions/setup-java@v1 + with: + java-version: "11" + architecture: x64 + + - name: Compile + run: ./gradlew compileJava + + test: + needs: [ compile ] + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up Java + id: setup-jre + uses: actions/setup-java@v1 + with: + java-version: "11" + architecture: x64 + + - name: Test + run: ./gradlew test + publish: + needs: [ compile, test ] + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up Java + id: setup-jre + uses: actions/setup-java@v1 + with: + java-version: "11" + architecture: x64 + + - name: Publish to maven + run: | + ./gradlew publish + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + MAVEN_PUBLISH_REGISTRY_URL: "https://s01.oss.sonatype.org/content/repositories/releases/" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d4199ab --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +*.class +.project +.gradle +? +.classpath +.checkstyle +.settings +.node +build + +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ +out/ + +# Eclipse/IntelliJ APT +generated_src/ +generated_testSrc/ +generated/ + +bin +build \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 871e0de..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# vapi-java-sdk -The official Java SDK for accessing Vapi's API diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..3e9ac56 --- /dev/null +++ b/build.gradle @@ -0,0 +1,70 @@ +plugins { + id 'java-library' + id 'maven-publish' + id 'com.diffplug.spotless' version '6.11.0' +} + +repositories { + mavenCentral() + maven { + url 'https://s01.oss.sonatype.org/content/repositories/releases/' + } +} + +dependencies { + api 'com.squareup.okhttp3:okhttp:4.12.0' + api 'com.fasterxml.jackson.core:jackson-databind:2.17.2' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.2' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' +} + + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +spotless { + java { + palantirJavaFormat() + } +} + +java { + withSourcesJar() + withJavadocJar() +} + +test { + useJUnitPlatform() + testLogging { + showStandardStreams = true + } +} +publishing { + publications { + maven(MavenPublication) { + groupId = 'dev.vapi' + artifactId = 'vapi-java-sdk' + version = '0.0.0-alpha3' + from components.java + pom { + scm { + connection = 'scm:git:git://github.com/fern-demo/vapi-java-sdk.git' + developerConnection = 'scm:git:git://github.com/fern-demo/vapi-java-sdk.git' + url = 'https://github.com/fern-demo/vapi-java-sdk' + } + } + } + } + repositories { + maven { + url "$System.env.MAVEN_PUBLISH_REGISTRY_URL" + credentials { + username "$System.env.MAVEN_USERNAME" + password "$System.env.MAVEN_PASSWORD" + } + } + } +} + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..a4b76b9 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..0aaefbc --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..f5feea6 --- /dev/null +++ b/gradlew @@ -0,0 +1,252 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..9b42019 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/sample-app/build.gradle b/sample-app/build.gradle new file mode 100644 index 0000000..4ee8f22 --- /dev/null +++ b/sample-app/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java-library' +} + +repositories { + mavenCentral() + maven { + url 'https://s01.oss.sonatype.org/content/repositories/releases/' + } +} + +dependencies { + implementation rootProject +} + + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + diff --git a/sample-app/src/main/java/sample/App.java b/sample-app/src/main/java/sample/App.java new file mode 100644 index 0000000..42a4b23 --- /dev/null +++ b/sample-app/src/main/java/sample/App.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +package sample; + +import java.lang.String; + +public final class App { + public static void main(String[] args) { + // import com.vapi.api.Vapi + } +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..aed36fe --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include 'sample-app' \ No newline at end of file diff --git a/src/main/java/com/vapi/api/Vapi.java b/src/main/java/com/vapi/api/Vapi.java new file mode 100644 index 0000000..bf4b19d --- /dev/null +++ b/src/main/java/com/vapi/api/Vapi.java @@ -0,0 +1,92 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api; + +import com.vapi.api.core.ClientOptions; +import com.vapi.api.core.Suppliers; +import com.vapi.api.resources.analytics.AnalyticsClient; +import com.vapi.api.resources.assistants.AssistantsClient; +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.logs.LogsClient; +import com.vapi.api.resources.phonenumbers.PhoneNumbersClient; +import com.vapi.api.resources.squads.SquadsClient; +import com.vapi.api.resources.tools.ToolsClient; +import java.util.function.Supplier; + +public class Vapi { + protected final ClientOptions clientOptions; + + protected final Supplier callsClient; + + protected final Supplier assistantsClient; + + protected final Supplier phoneNumbersClient; + + protected final Supplier squadsClient; + + protected final Supplier blocksClient; + + protected final Supplier toolsClient; + + protected final Supplier filesClient; + + protected final Supplier analyticsClient; + + protected final Supplier logsClient; + + public Vapi(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.callsClient = Suppliers.memoize(() -> new CallsClient(clientOptions)); + this.assistantsClient = Suppliers.memoize(() -> new AssistantsClient(clientOptions)); + this.phoneNumbersClient = Suppliers.memoize(() -> new PhoneNumbersClient(clientOptions)); + this.squadsClient = Suppliers.memoize(() -> new SquadsClient(clientOptions)); + this.blocksClient = Suppliers.memoize(() -> new BlocksClient(clientOptions)); + this.toolsClient = Suppliers.memoize(() -> new ToolsClient(clientOptions)); + this.filesClient = Suppliers.memoize(() -> new FilesClient(clientOptions)); + this.analyticsClient = Suppliers.memoize(() -> new AnalyticsClient(clientOptions)); + this.logsClient = Suppliers.memoize(() -> new LogsClient(clientOptions)); + } + + public CallsClient calls() { + return this.callsClient.get(); + } + + public AssistantsClient assistants() { + return this.assistantsClient.get(); + } + + public PhoneNumbersClient phoneNumbers() { + return this.phoneNumbersClient.get(); + } + + public SquadsClient squads() { + return this.squadsClient.get(); + } + + public BlocksClient blocks() { + return this.blocksClient.get(); + } + + public ToolsClient tools() { + return this.toolsClient.get(); + } + + public FilesClient files() { + return this.filesClient.get(); + } + + public AnalyticsClient analytics() { + return this.analyticsClient.get(); + } + + public LogsClient logs() { + return this.logsClient.get(); + } + + public static VapiBuilder builder() { + return new VapiBuilder(); + } +} diff --git a/src/main/java/com/vapi/api/VapiBuilder.java b/src/main/java/com/vapi/api/VapiBuilder.java new file mode 100644 index 0000000..e4616eb --- /dev/null +++ b/src/main/java/com/vapi/api/VapiBuilder.java @@ -0,0 +1,42 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api; + +import com.vapi.api.core.ClientOptions; +import com.vapi.api.core.Environment; + +public final class VapiBuilder { + private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); + + private String token = null; + + private Environment environment = Environment.DEFAULT; + + /** + * Sets token + */ + public VapiBuilder token(String token) { + this.token = token; + return this; + } + + public VapiBuilder environment(Environment environment) { + this.environment = environment; + return this; + } + + public VapiBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + 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()); + } +} diff --git a/src/main/java/com/vapi/api/core/ClientOptions.java b/src/main/java/com/vapi/api/core/ClientOptions.java new file mode 100644 index 0000000..d18e2c6 --- /dev/null +++ b/src/main/java/com/vapi/api/core/ClientOptions.java @@ -0,0 +1,105 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +import okhttp3.OkHttpClient; + +public final class ClientOptions { + private final Environment environment; + + private final Map headers; + + private final Map> headerSuppliers; + + private final OkHttpClient httpClient; + + private ClientOptions( + Environment environment, + Map headers, + Map> headerSuppliers, + OkHttpClient httpClient) { + this.environment = environment; + this.headers = new HashMap<>(); + this.headers.putAll(headers); + this.headers.putAll(new HashMap() { + { + put("X-Fern-Language", "JAVA"); + put("X-Fern-SDK-Name", "com.vapi.fern:api-sdk"); + put("X-Fern-SDK-Version", "0.0.0-alpha3"); + } + }); + this.headerSuppliers = headerSuppliers; + this.httpClient = httpClient; + } + + public Environment environment() { + return this.environment; + } + + public Map headers(RequestOptions requestOptions) { + Map values = new HashMap<>(this.headers); + headerSuppliers.forEach((key, supplier) -> { + values.put(key, supplier.get()); + }); + if (requestOptions != null) { + values.putAll(requestOptions.getHeaders()); + } + return values; + } + + public OkHttpClient httpClient() { + return this.httpClient; + } + + public OkHttpClient httpClientWithTimeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.httpClient; + } + return this.httpClient + .newBuilder() + .callTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit()) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .build(); + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private Environment environment; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + public Builder environment(Environment environment) { + this.environment = environment; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + public ClientOptions build() { + OkHttpClient okhttpClient = new OkHttpClient.Builder() + .addInterceptor(new RetryInterceptor(3)) + .build(); + return new ClientOptions(environment, headers, headerSuppliers, okhttpClient); + } + } +} diff --git a/src/main/java/com/vapi/api/core/DateTimeDeserializer.java b/src/main/java/com/vapi/api/core/DateTimeDeserializer.java new file mode 100644 index 0000000..d633ae7 --- /dev/null +++ b/src/main/java/com/vapi/api/core/DateTimeDeserializer.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.module.SimpleModule; +import java.io.IOException; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalQueries; + +/** + * Custom deserializer that handles converting ISO8601 dates into {@link OffsetDateTime} objects. + */ +class DateTimeDeserializer extends JsonDeserializer { + private static final SimpleModule MODULE; + + static { + MODULE = new SimpleModule().addDeserializer(OffsetDateTime.class, new DateTimeDeserializer()); + } + + /** + * Gets a module wrapping this deserializer as an adapter for the Jackson ObjectMapper. + * + * @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper. + */ + public static SimpleModule getModule() { + return MODULE; + } + + @Override + public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException { + JsonToken token = parser.currentToken(); + if (token == JsonToken.VALUE_NUMBER_INT) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC); + } else { + TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest( + parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from); + + if (temporal.query(TemporalQueries.offset()) == null) { + return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC); + } else { + return OffsetDateTime.from(temporal); + } + } + } +} diff --git a/src/main/java/com/vapi/api/core/Environment.java b/src/main/java/com/vapi/api/core/Environment.java new file mode 100644 index 0000000..86435fa --- /dev/null +++ b/src/main/java/com/vapi/api/core/Environment.java @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core; + +public final class Environment { + public static final Environment DEFAULT = new Environment("https://api.vapi.ai"); + + private final String url; + + private Environment(String url) { + this.url = url; + } + + public String getUrl() { + return this.url; + } + + public static Environment custom(String url) { + return new Environment(url); + } +} diff --git a/src/main/java/com/vapi/api/core/FileStream.java b/src/main/java/com/vapi/api/core/FileStream.java new file mode 100644 index 0000000..2dae980 --- /dev/null +++ b/src/main/java/com/vapi/api/core/FileStream.java @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core; + +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import org.jetbrains.annotations.Nullable; + +/** + * Represents a file stream with associated metadata for file uploads. + */ +public class FileStream { + private final InputStream inputStream; + private final String fileName; + private final MediaType contentType; + + /** + * Constructs a FileStream with the given input stream and optional metadata. + * + * @param inputStream The input stream of the file content. Must not be null. + * @param fileName The name of the file, or null if unknown. + * @param contentType The MIME type of the file content, or null if unknown. + * @throws NullPointerException if inputStream is null + */ + public FileStream(InputStream inputStream, @Nullable String fileName, @Nullable MediaType contentType) { + this.inputStream = Objects.requireNonNull(inputStream, "Input stream cannot be null"); + this.fileName = fileName; + this.contentType = contentType; + } + + public FileStream(InputStream inputStream) { + this(inputStream, null, null); + } + + public InputStream getInputStream() { + return inputStream; + } + + @Nullable + public String getFileName() { + return fileName; + } + + @Nullable + public MediaType getContentType() { + return contentType; + } + + /** + * Creates a RequestBody suitable for use with OkHttp client. + * + * @return A RequestBody instance representing this file stream. + */ + public RequestBody toRequestBody() { + return new InputStreamRequestBody(contentType, inputStream); + } +} diff --git a/src/main/java/com/vapi/api/core/InputStreamRequestBody.java b/src/main/java/com/vapi/api/core/InputStreamRequestBody.java new file mode 100644 index 0000000..3e14fc8 --- /dev/null +++ b/src/main/java/com/vapi/api/core/InputStreamRequestBody.java @@ -0,0 +1,79 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import okhttp3.internal.Util; +import okio.BufferedSink; +import okio.Okio; +import okio.Source; +import org.jetbrains.annotations.Nullable; + +/** + * A custom implementation of OkHttp's RequestBody that wraps an InputStream. + * This class allows streaming of data from an InputStream directly to an HTTP request body, + * which is useful for file uploads or sending large amounts of data without loading it all into memory. + */ +public class InputStreamRequestBody extends RequestBody { + private final InputStream inputStream; + private final MediaType contentType; + + /** + * Constructs an InputStreamRequestBody with the specified content type and input stream. + * + * @param contentType the MediaType of the content, or null if not known + * @param inputStream the InputStream containing the data to be sent + * @throws NullPointerException if inputStream is null + */ + public InputStreamRequestBody(@Nullable MediaType contentType, InputStream inputStream) { + this.contentType = contentType; + this.inputStream = Objects.requireNonNull(inputStream, "inputStream == null"); + } + + /** + * Returns the content type of this request body. + * + * @return the MediaType of the content, or null if not specified + */ + @Nullable + @Override + public MediaType contentType() { + return contentType; + } + + /** + * Returns the content length of this request body, if known. + * This method attempts to determine the length using the InputStream's available() method, + * which may not always accurately reflect the total length of the stream. + * + * @return the content length, or -1 if the length is unknown + * @throws IOException if an I/O error occurs + */ + @Override + public long contentLength() throws IOException { + return inputStream.available() == 0 ? -1 : inputStream.available(); + } + + /** + * Writes the content of the InputStream to the given BufferedSink. + * This method is responsible for transferring the data from the InputStream to the network request. + * + * @param sink the BufferedSink to write the content to + * @throws IOException if an I/O error occurs during writing + */ + @Override + public void writeTo(BufferedSink sink) throws IOException { + Source source = null; + try { + source = Okio.source(inputStream); + sink.writeAll(source); + } finally { + Util.closeQuietly(Objects.requireNonNull(source)); + } + } +} diff --git a/src/main/java/com/vapi/api/core/MediaTypes.java b/src/main/java/com/vapi/api/core/MediaTypes.java new file mode 100644 index 0000000..d3c63c3 --- /dev/null +++ b/src/main/java/com/vapi/api/core/MediaTypes.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core; + +import okhttp3.MediaType; + +public final class MediaTypes { + + public static final MediaType APPLICATION_JSON = MediaType.parse("application/json"); + + private MediaTypes() {} +} diff --git a/src/main/java/com/vapi/api/core/ObjectMappers.java b/src/main/java/com/vapi/api/core/ObjectMappers.java new file mode 100644 index 0000000..ed8e904 --- /dev/null +++ b/src/main/java/com/vapi/api/core/ObjectMappers.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.io.IOException; + +public final class ObjectMappers { + public static final ObjectMapper JSON_MAPPER = JsonMapper.builder() + .addModule(new Jdk8Module()) + .addModule(new JavaTimeModule()) + .addModule(DateTimeDeserializer.getModule()) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .build(); + + private ObjectMappers() {} + + public static String stringify(Object o) { + try { + return JSON_MAPPER + .setSerializationInclusion(JsonInclude.Include.ALWAYS) + .writerWithDefaultPrettyPrinter() + .writeValueAsString(o); + } catch (IOException e) { + return o.getClass().getName() + "@" + Integer.toHexString(o.hashCode()); + } + } +} diff --git a/src/main/java/com/vapi/api/core/RequestOptions.java b/src/main/java/com/vapi/api/core/RequestOptions.java new file mode 100644 index 0000000..414c30c --- /dev/null +++ b/src/main/java/com/vapi/api/core/RequestOptions.java @@ -0,0 +1,71 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; + +public final class RequestOptions { + private final String token; + + private final Optional timeout; + + private final TimeUnit timeoutTimeUnit; + + private RequestOptions(String token, Optional timeout, TimeUnit timeoutTimeUnit) { + this.token = token; + this.timeout = timeout; + this.timeoutTimeUnit = timeoutTimeUnit; + } + + public Optional getTimeout() { + return timeout; + } + + public TimeUnit getTimeoutTimeUnit() { + return timeoutTimeUnit; + } + + public Map getHeaders() { + Map headers = new HashMap<>(); + if (this.token != null) { + headers.put("Authorization", "Bearer " + this.token); + } + return headers; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private String token = null; + + private Optional timeout = Optional.empty(); + + private TimeUnit timeoutTimeUnit = TimeUnit.SECONDS; + + public Builder token(String token) { + this.token = token; + return this; + } + + public Builder timeout(Integer timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + public Builder timeout(Integer timeout, TimeUnit timeoutTimeUnit) { + this.timeout = Optional.of(timeout); + this.timeoutTimeUnit = timeoutTimeUnit; + return this; + } + + public RequestOptions build() { + return new RequestOptions(token, timeout, timeoutTimeUnit); + } + } +} diff --git a/src/main/java/com/vapi/api/core/ResponseBodyInputStream.java b/src/main/java/com/vapi/api/core/ResponseBodyInputStream.java new file mode 100644 index 0000000..8f3d24f --- /dev/null +++ b/src/main/java/com/vapi/api/core/ResponseBodyInputStream.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core; + +import java.io.FilterInputStream; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom InputStream that wraps the InputStream from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the stream is closed. + * + * This class extends FilterInputStream and takes an OkHttp Response object as a parameter. + * It retrieves the InputStream from the Response and overrides the close method to close + * both the InputStream and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyInputStream extends FilterInputStream { + private final Response response; + + /** + * Constructs a ResponseBodyInputStream that wraps the InputStream from the given OkHttp + * Response object. + * + * @param response the OkHttp Response object from which the InputStream is retrieved + * @throws IOException if an I/O error occurs while retrieving the InputStream + */ + public ResponseBodyInputStream(Response response) throws IOException { + super(response.body().byteStream()); + this.response = response; + } + + /** + * Closes the InputStream and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the stream is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the stream is closed + } +} diff --git a/src/main/java/com/vapi/api/core/ResponseBodyReader.java b/src/main/java/com/vapi/api/core/ResponseBodyReader.java new file mode 100644 index 0000000..b6f574c --- /dev/null +++ b/src/main/java/com/vapi/api/core/ResponseBodyReader.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core; + +import java.io.FilterReader; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom Reader that wraps the Reader from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the reader is closed. + * + * This class extends FilterReader and takes an OkHttp Response object as a parameter. + * It retrieves the Reader from the Response and overrides the close method to close + * both the Reader and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyReader extends FilterReader { + private final Response response; + + /** + * Constructs a ResponseBodyReader that wraps the Reader from the given OkHttp Response object. + * + * @param response the OkHttp Response object from which the Reader is retrieved + * @throws IOException if an I/O error occurs while retrieving the Reader + */ + public ResponseBodyReader(Response response) throws IOException { + super(response.body().charStream()); + this.response = response; + } + + /** + * Closes the Reader and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the reader is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the reader is closed + } +} diff --git a/src/main/java/com/vapi/api/core/RetryInterceptor.java b/src/main/java/com/vapi/api/core/RetryInterceptor.java new file mode 100644 index 0000000..3dd9bb2 --- /dev/null +++ b/src/main/java/com/vapi/api/core/RetryInterceptor.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core; + +import java.io.IOException; +import java.time.Duration; +import java.util.Optional; +import java.util.Random; +import okhttp3.Interceptor; +import okhttp3.Response; + +public class RetryInterceptor implements Interceptor { + + private static final Duration ONE_SECOND = Duration.ofSeconds(1); + private final ExponentialBackoff backoff; + private final Random random = new Random(); + + public RetryInterceptor(int maxRetries) { + this.backoff = new ExponentialBackoff(maxRetries); + } + + @Override + public Response intercept(Chain chain) throws IOException { + Response response = chain.proceed(chain.request()); + + if (shouldRetry(response.code())) { + return retryChain(response, chain); + } + + return response; + } + + private Response retryChain(Response response, Chain chain) throws IOException { + Optional nextBackoff = this.backoff.nextBackoff(); + while (nextBackoff.isPresent()) { + try { + Thread.sleep(nextBackoff.get().toMillis()); + } catch (InterruptedException e) { + throw new IOException("Interrupted while trying request", e); + } + response.close(); + response = chain.proceed(chain.request()); + if (shouldRetry(response.code())) { + nextBackoff = this.backoff.nextBackoff(); + } else { + return response; + } + } + + return response; + } + + private static boolean shouldRetry(int statusCode) { + return statusCode == 408 || statusCode == 409 || statusCode == 429 || statusCode >= 500; + } + + private final class ExponentialBackoff { + + private final int maxNumRetries; + + private int retryNumber = 0; + + ExponentialBackoff(int maxNumRetries) { + this.maxNumRetries = maxNumRetries; + } + + public Optional nextBackoff() { + retryNumber += 1; + if (retryNumber > maxNumRetries) { + return Optional.empty(); + } + + int upperBound = (int) Math.pow(2, retryNumber); + return Optional.of(ONE_SECOND.multipliedBy(random.nextInt(upperBound))); + } + } +} diff --git a/src/main/java/com/vapi/api/core/Stream.java b/src/main/java/com/vapi/api/core/Stream.java new file mode 100644 index 0000000..3675336 --- /dev/null +++ b/src/main/java/com/vapi/api/core/Stream.java @@ -0,0 +1,97 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core; + +import java.io.Reader; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.Scanner; + +/** + * The {@code Stream} class implmenets {@link Iterable} to provide a simple mechanism for reading and parsing + * objects of a given type from data streamed via a {@link Reader} using a specified delimiter. + *

+ * {@code Stream} assumes that data is being pushed to the provided {@link Reader} asynchronously and utilizes a + * {@code Scanner} to block during iteration if the next object is not available. + * + * @param The type of objects in the stream. + */ +public final class Stream implements Iterable { + /** + * The {@link Class} of the objects in the stream. + */ + private final Class valueType; + /** + * The {@link Scanner} used for reading from the input stream and blocking when neede during iteration. + */ + private final Scanner scanner; + + /** + * Constructs a new {@code Stream} with the specified value type, reader, and delimiter. + * + * @param valueType The class of the objects in the stream. + * @param reader The reader that provides the streamed data. + * @param delimiter The delimiter used to separate elements in the stream. + */ + public Stream(Class valueType, Reader reader, String delimiter) { + this.scanner = new Scanner(reader).useDelimiter(delimiter); + this.valueType = valueType; + } + + /** + * Returns an iterator over the elements in this stream that blocks during iteration when the next object is + * not yet available. + * + * @return An iterator that can be used to traverse the elements in the stream. + */ + @Override + public Iterator iterator() { + return new Iterator() { + /** + * Returns {@code true} if there are more elements in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return {@code true} if there are more elements, {@code false} otherwise. + */ + @Override + public boolean hasNext() { + return scanner.hasNext(); + } + + /** + * Returns the next element in the stream. + *

+ * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return The next element in the stream. + * @throws NoSuchElementException If there are no more elements in the stream. + */ + @Override + public T next() { + if (!scanner.hasNext()) { + throw new NoSuchElementException(); + } else { + try { + T parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + scanner.next().trim(), valueType); + return parsedResponse; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + /** + * Removing elements from {@code Stream} is not supported. + * + * @throws UnsupportedOperationException Always, as removal is not supported. + */ + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + }; + } +} diff --git a/src/main/java/com/vapi/api/core/Suppliers.java b/src/main/java/com/vapi/api/core/Suppliers.java new file mode 100644 index 0000000..b24e0f1 --- /dev/null +++ b/src/main/java/com/vapi/api/core/Suppliers.java @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +public final class Suppliers { + private Suppliers() {} + + public static Supplier memoize(Supplier delegate) { + AtomicReference value = new AtomicReference<>(); + return () -> { + T val = value.get(); + if (val == null) { + val = value.updateAndGet(cur -> cur == null ? Objects.requireNonNull(delegate.get()) : cur); + } + return val; + }; + } +} diff --git a/src/main/java/com/vapi/api/core/VapiApiException.java b/src/main/java/com/vapi/api/core/VapiApiException.java new file mode 100644 index 0000000..ef6d222 --- /dev/null +++ b/src/main/java/com/vapi/api/core/VapiApiException.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core; + +/** + * This exception type will be thrown for any non-2XX API responses. + */ +public class VapiApiException extends VapiException { + /** + * The error code of the response that triggered the exception. + */ + private final int statusCode; + + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + public VapiApiException(String message, int statusCode, Object body) { + super(message); + this.statusCode = statusCode; + this.body = body; + } + + /** + * @return the statusCode + */ + public int statusCode() { + return this.statusCode; + } + + /** + * @return the body + */ + public Object body() { + return this.body; + } + + @java.lang.Override + public String toString() { + return "VapiApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + body + + "}"; + } +} diff --git a/src/main/java/com/vapi/api/core/VapiException.java b/src/main/java/com/vapi/api/core/VapiException.java new file mode 100644 index 0000000..c33a18a --- /dev/null +++ b/src/main/java/com/vapi/api/core/VapiException.java @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core; + +/** + * This class serves as the base exception for all errors in the SDK. + */ +public class VapiException extends RuntimeException { + public VapiException(String message) { + super(message); + } + + public VapiException(String message, Exception e) { + super(message, e); + } +} diff --git a/src/main/java/com/vapi/api/core/pagination/BasePage.java b/src/main/java/com/vapi/api/core/pagination/BasePage.java new file mode 100644 index 0000000..b876ca2 --- /dev/null +++ b/src/main/java/com/vapi/api/core/pagination/BasePage.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core.pagination; + +import java.util.List; + +public abstract class BasePage { + private final boolean hasNext; + private final List items; + + public BasePage(boolean hasNext, List items) { + this.hasNext = hasNext; + this.items = items; + } + + public boolean hasNext() { + return !items.isEmpty() && hasNext; + } + + public List getItems() { + return items; + } +} diff --git a/src/main/java/com/vapi/api/core/pagination/SyncPage.java b/src/main/java/com/vapi/api/core/pagination/SyncPage.java new file mode 100644 index 0000000..28d63b3 --- /dev/null +++ b/src/main/java/com/vapi/api/core/pagination/SyncPage.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core.pagination; + +import java.util.List; +import java.util.NoSuchElementException; +import java.util.function.Supplier; + +public class SyncPage extends BasePage { + protected final Supplier> nextSupplier; + + public SyncPage(boolean hasNext, List items, Supplier> nextSupplier) { + super(hasNext, items); + this.nextSupplier = nextSupplier; + } + + public SyncPage nextPage() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + return nextSupplier.get(); + } +} diff --git a/src/main/java/com/vapi/api/core/pagination/SyncPagingIterable.java b/src/main/java/com/vapi/api/core/pagination/SyncPagingIterable.java new file mode 100644 index 0000000..33c75fd --- /dev/null +++ b/src/main/java/com/vapi/api/core/pagination/SyncPagingIterable.java @@ -0,0 +1,61 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.core.pagination; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Optional; +import java.util.function.Supplier; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +public class SyncPagingIterable extends SyncPage implements Iterable { + + public SyncPagingIterable(boolean hasNext, List items, Supplier> getNext) { + super(hasNext, items, getNext); + } + + public SyncPagingIterable(boolean hasNext, Optional> items, Supplier> getNext) { + super(hasNext, items.orElse(new ArrayList<>()), getNext); + } + + public Stream streamItems() { + return StreamSupport.stream(this.spliterator(), false); + } + + @Override + public Iterator iterator() { + return new Iterator() { + private Iterator itemsIterator = getItems().iterator(); + private SyncPage currentPage = SyncPagingIterable.this; + + @Override + public boolean hasNext() { + if (itemsIterator.hasNext()) { + return true; + } + if (currentPage.hasNext()) { + advancePage(); + return itemsIterator.hasNext(); + } + return false; + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + return itemsIterator.next(); + } + + private void advancePage() { + currentPage = currentPage.nextPage(); + itemsIterator = currentPage.getItems().iterator(); + } + }; + } +} diff --git a/src/main/java/com/vapi/api/errors/BadRequestError.java b/src/main/java/com/vapi/api/errors/BadRequestError.java new file mode 100644 index 0000000..5d50a49 --- /dev/null +++ b/src/main/java/com/vapi/api/errors/BadRequestError.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.errors; + +import com.vapi.api.core.VapiApiException; + +public final class BadRequestError extends VapiApiException { + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + public BadRequestError(Object body) { + super("BadRequestError", 400, body); + this.body = body; + } + + /** + * @return the body + */ + @java.lang.Override + public Object body() { + return this.body; + } +} diff --git a/src/main/java/com/vapi/api/resources/analytics/AnalyticsClient.java b/src/main/java/com/vapi/api/resources/analytics/AnalyticsClient.java new file mode 100644 index 0000000..5e02b3a --- /dev/null +++ b/src/main/java/com/vapi/api/resources/analytics/AnalyticsClient.java @@ -0,0 +1,74 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +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; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class AnalyticsClient { + protected final ClientOptions clientOptions; + + public AnalyticsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public List get(AnalyticsQueryDto request) { + return get(request, null); + } + + public List get(AnalyticsQueryDto request, 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) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/analytics/requests/AnalyticsQueryDto.java b/src/main/java/com/vapi/api/resources/analytics/requests/AnalyticsQueryDto.java new file mode 100644 index 0000000..7be1a78 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/analytics/requests/AnalyticsQueryDto.java @@ -0,0 +1,106 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.analytics.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import com.vapi.api.types.AnalyticsQuery; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AnalyticsQueryDto.Builder.class) +public final class AnalyticsQueryDto { + private final List queries; + + private final Map additionalProperties; + + private AnalyticsQueryDto(List queries, Map additionalProperties) { + this.queries = queries; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the list of metric queries you want to perform. + */ + @JsonProperty("queries") + public List getQueries() { + return queries; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnalyticsQueryDto && equalTo((AnalyticsQueryDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AnalyticsQueryDto other) { + return queries.equals(other.queries); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.queries); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List queries = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AnalyticsQueryDto other) { + queries(other.getQueries()); + return this; + } + + @JsonSetter(value = "queries", nulls = Nulls.SKIP) + public Builder queries(List queries) { + this.queries.clear(); + this.queries.addAll(queries); + return this; + } + + public Builder addQueries(AnalyticsQuery queries) { + this.queries.add(queries); + return this; + } + + public Builder addAllQueries(List queries) { + this.queries.addAll(queries); + return this; + } + + public AnalyticsQueryDto build() { + return new AnalyticsQueryDto(queries, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/assistants/AssistantsClient.java b/src/main/java/com/vapi/api/resources/assistants/AssistantsClient.java new file mode 100644 index 0000000..e34302d --- /dev/null +++ b/src/main/java/com/vapi/api/resources/assistants/AssistantsClient.java @@ -0,0 +1,268 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.assistants; + +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.assistants.requests.AssistantsListRequest; +import com.vapi.api.resources.assistants.requests.UpdateAssistantDto; +import com.vapi.api.types.Assistant; +import com.vapi.api.types.CreateAssistantDto; +import java.io.IOException; +import java.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class AssistantsClient { + protected final ClientOptions clientOptions; + + public AssistantsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public List list() { + return list(AssistantsListRequest.builder().build()); + } + + public List list(AssistantsListRequest request) { + return list(request, null); + } + + public List list(AssistantsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("assistant"); + if (request.getLimit().isPresent()) { + httpUrl.addQueryParameter("limit", request.getLimit().get().toString()); + } + if (request.getCreatedAtGt().isPresent()) { + httpUrl.addQueryParameter( + "createdAtGt", request.getCreatedAtGt().get().toString()); + } + if (request.getCreatedAtLt().isPresent()) { + httpUrl.addQueryParameter( + "createdAtLt", request.getCreatedAtLt().get().toString()); + } + if (request.getCreatedAtGe().isPresent()) { + httpUrl.addQueryParameter( + "createdAtGe", request.getCreatedAtGe().get().toString()); + } + if (request.getCreatedAtLe().isPresent()) { + httpUrl.addQueryParameter( + "createdAtLe", request.getCreatedAtLe().get().toString()); + } + if (request.getUpdatedAtGt().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtGt", request.getUpdatedAtGt().get().toString()); + } + if (request.getUpdatedAtLt().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtLt", request.getUpdatedAtLt().get().toString()); + } + if (request.getUpdatedAtGe().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtGe", request.getUpdatedAtGe().get().toString()); + } + if (request.getUpdatedAtLe().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtLe", request.getUpdatedAtLe().get().toString()); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public Assistant create() { + return create(CreateAssistantDto.builder().build()); + } + + public Assistant create(CreateAssistantDto request) { + return create(request, null); + } + + public Assistant create(CreateAssistantDto request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("assistant") + .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) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Assistant.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public Assistant get(String id) { + return get(id, null); + } + + public Assistant get(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("assistant") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Assistant.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public Assistant delete(String id) { + return delete(id, null); + } + + public Assistant delete(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("assistant") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Assistant.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public Assistant update(String id) { + return update(id, UpdateAssistantDto.builder().build()); + } + + public Assistant update(String id, UpdateAssistantDto request) { + return update(id, request, null); + } + + public Assistant update(String id, UpdateAssistantDto request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("assistant") + .addPathSegment(id) + .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("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Assistant.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/assistants/requests/AssistantsListRequest.java b/src/main/java/com/vapi/api/resources/assistants/requests/AssistantsListRequest.java new file mode 100644 index 0000000..926e88d --- /dev/null +++ b/src/main/java/com/vapi/api/resources/assistants/requests/AssistantsListRequest.java @@ -0,0 +1,336 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.assistants.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AssistantsListRequest.Builder.class) +public final class AssistantsListRequest { + private final Optional limit; + + private final Optional createdAtGt; + + private final Optional createdAtLt; + + private final Optional createdAtGe; + + private final Optional createdAtLe; + + private final Optional updatedAtGt; + + private final Optional updatedAtLt; + + private final Optional updatedAtGe; + + private final Optional updatedAtLe; + + private final Map additionalProperties; + + private AssistantsListRequest( + Optional limit, + Optional createdAtGt, + Optional createdAtLt, + Optional createdAtGe, + Optional createdAtLe, + Optional updatedAtGt, + Optional updatedAtLt, + Optional updatedAtGe, + Optional updatedAtLe, + Map additionalProperties) { + this.limit = limit; + this.createdAtGt = createdAtGt; + this.createdAtLt = createdAtLt; + this.createdAtGe = createdAtGe; + this.createdAtLe = createdAtLe; + this.updatedAtGt = updatedAtGt; + this.updatedAtLt = updatedAtLt; + this.updatedAtGe = updatedAtGe; + this.updatedAtLe = updatedAtLe; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the maximum number of items to return. Defaults to 100. + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return This will return items where the createdAt is greater than the specified value. + */ + @JsonProperty("createdAtGt") + public Optional getCreatedAtGt() { + return createdAtGt; + } + + /** + * @return This will return items where the createdAt is less than the specified value. + */ + @JsonProperty("createdAtLt") + public Optional getCreatedAtLt() { + return createdAtLt; + } + + /** + * @return This will return items where the createdAt is greater than or equal to the specified value. + */ + @JsonProperty("createdAtGe") + public Optional getCreatedAtGe() { + return createdAtGe; + } + + /** + * @return This will return items where the createdAt is less than or equal to the specified value. + */ + @JsonProperty("createdAtLe") + public Optional getCreatedAtLe() { + return createdAtLe; + } + + /** + * @return This will return items where the updatedAt is greater than the specified value. + */ + @JsonProperty("updatedAtGt") + public Optional getUpdatedAtGt() { + return updatedAtGt; + } + + /** + * @return This will return items where the updatedAt is less than the specified value. + */ + @JsonProperty("updatedAtLt") + public Optional getUpdatedAtLt() { + return updatedAtLt; + } + + /** + * @return This will return items where the updatedAt is greater than or equal to the specified value. + */ + @JsonProperty("updatedAtGe") + public Optional getUpdatedAtGe() { + return updatedAtGe; + } + + /** + * @return This will return items where the updatedAt is less than or equal to the specified value. + */ + @JsonProperty("updatedAtLe") + public Optional getUpdatedAtLe() { + return updatedAtLe; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AssistantsListRequest && equalTo((AssistantsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AssistantsListRequest other) { + return limit.equals(other.limit) + && createdAtGt.equals(other.createdAtGt) + && createdAtLt.equals(other.createdAtLt) + && createdAtGe.equals(other.createdAtGe) + && createdAtLe.equals(other.createdAtLe) + && updatedAtGt.equals(other.updatedAtGt) + && updatedAtLt.equals(other.updatedAtLt) + && updatedAtGe.equals(other.updatedAtGe) + && updatedAtLe.equals(other.updatedAtLe); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.limit, + this.createdAtGt, + this.createdAtLt, + this.createdAtGe, + this.createdAtLe, + this.updatedAtGt, + this.updatedAtLt, + this.updatedAtGe, + this.updatedAtLe); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional limit = Optional.empty(); + + private Optional createdAtGt = Optional.empty(); + + private Optional createdAtLt = Optional.empty(); + + private Optional createdAtGe = Optional.empty(); + + private Optional createdAtLe = Optional.empty(); + + private Optional updatedAtGt = Optional.empty(); + + private Optional updatedAtLt = Optional.empty(); + + private Optional updatedAtGe = Optional.empty(); + + private Optional updatedAtLe = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AssistantsListRequest other) { + limit(other.getLimit()); + createdAtGt(other.getCreatedAtGt()); + createdAtLt(other.getCreatedAtLt()); + createdAtGe(other.getCreatedAtGe()); + createdAtLe(other.getCreatedAtLe()); + updatedAtGt(other.getUpdatedAtGt()); + updatedAtLt(other.getUpdatedAtLt()); + updatedAtGe(other.getUpdatedAtGe()); + updatedAtLe(other.getUpdatedAtLe()); + return this; + } + + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Double limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + @JsonSetter(value = "createdAtGt", nulls = Nulls.SKIP) + public Builder createdAtGt(Optional createdAtGt) { + this.createdAtGt = createdAtGt; + return this; + } + + public Builder createdAtGt(OffsetDateTime createdAtGt) { + this.createdAtGt = Optional.ofNullable(createdAtGt); + return this; + } + + @JsonSetter(value = "createdAtLt", nulls = Nulls.SKIP) + public Builder createdAtLt(Optional createdAtLt) { + this.createdAtLt = createdAtLt; + return this; + } + + public Builder createdAtLt(OffsetDateTime createdAtLt) { + this.createdAtLt = Optional.ofNullable(createdAtLt); + return this; + } + + @JsonSetter(value = "createdAtGe", nulls = Nulls.SKIP) + public Builder createdAtGe(Optional createdAtGe) { + this.createdAtGe = createdAtGe; + return this; + } + + public Builder createdAtGe(OffsetDateTime createdAtGe) { + this.createdAtGe = Optional.ofNullable(createdAtGe); + return this; + } + + @JsonSetter(value = "createdAtLe", nulls = Nulls.SKIP) + public Builder createdAtLe(Optional createdAtLe) { + this.createdAtLe = createdAtLe; + return this; + } + + public Builder createdAtLe(OffsetDateTime createdAtLe) { + this.createdAtLe = Optional.ofNullable(createdAtLe); + return this; + } + + @JsonSetter(value = "updatedAtGt", nulls = Nulls.SKIP) + public Builder updatedAtGt(Optional updatedAtGt) { + this.updatedAtGt = updatedAtGt; + return this; + } + + public Builder updatedAtGt(OffsetDateTime updatedAtGt) { + this.updatedAtGt = Optional.ofNullable(updatedAtGt); + return this; + } + + @JsonSetter(value = "updatedAtLt", nulls = Nulls.SKIP) + public Builder updatedAtLt(Optional updatedAtLt) { + this.updatedAtLt = updatedAtLt; + return this; + } + + public Builder updatedAtLt(OffsetDateTime updatedAtLt) { + this.updatedAtLt = Optional.ofNullable(updatedAtLt); + return this; + } + + @JsonSetter(value = "updatedAtGe", nulls = Nulls.SKIP) + public Builder updatedAtGe(Optional updatedAtGe) { + this.updatedAtGe = updatedAtGe; + return this; + } + + public Builder updatedAtGe(OffsetDateTime updatedAtGe) { + this.updatedAtGe = Optional.ofNullable(updatedAtGe); + return this; + } + + @JsonSetter(value = "updatedAtLe", nulls = Nulls.SKIP) + public Builder updatedAtLe(Optional updatedAtLe) { + this.updatedAtLe = updatedAtLe; + return this; + } + + public Builder updatedAtLe(OffsetDateTime updatedAtLe) { + this.updatedAtLe = Optional.ofNullable(updatedAtLe); + return this; + } + + public AssistantsListRequest build() { + return new AssistantsListRequest( + limit, + createdAtGt, + createdAtLt, + createdAtGe, + createdAtLe, + updatedAtGt, + updatedAtLt, + updatedAtGe, + updatedAtLe, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/assistants/requests/UpdateAssistantDto.java b/src/main/java/com/vapi/api/resources/assistants/requests/UpdateAssistantDto.java new file mode 100644 index 0000000..3baa966 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/assistants/requests/UpdateAssistantDto.java @@ -0,0 +1,1006 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.assistants.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import com.vapi.api.resources.assistants.types.UpdateAssistantDtoBackgroundSound; +import com.vapi.api.resources.assistants.types.UpdateAssistantDtoClientMessagesItem; +import com.vapi.api.resources.assistants.types.UpdateAssistantDtoFirstMessageMode; +import com.vapi.api.resources.assistants.types.UpdateAssistantDtoModel; +import com.vapi.api.resources.assistants.types.UpdateAssistantDtoServerMessagesItem; +import com.vapi.api.resources.assistants.types.UpdateAssistantDtoTranscriber; +import com.vapi.api.resources.assistants.types.UpdateAssistantDtoVoice; +import com.vapi.api.types.AnalysisPlan; +import com.vapi.api.types.ArtifactPlan; +import com.vapi.api.types.MessagePlan; +import com.vapi.api.types.MonitorPlan; +import com.vapi.api.types.StartSpeakingPlan; +import com.vapi.api.types.StopSpeakingPlan; +import com.vapi.api.types.TransportConfigurationTwilio; +import com.vapi.api.types.TwilioVoicemailDetection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAssistantDto.Builder.class) +public final class UpdateAssistantDto { + private final Optional transcriber; + + private final Optional model; + + private final Optional voice; + + private final Optional firstMessageMode; + + private final Optional hipaaEnabled; + + private final Optional> clientMessages; + + private final Optional> serverMessages; + + private final Optional silenceTimeoutSeconds; + + private final Optional maxDurationSeconds; + + private final Optional backgroundSound; + + private final Optional backchannelingEnabled; + + private final Optional backgroundDenoisingEnabled; + + private final Optional modelOutputInMessagesEnabled; + + private final Optional> transportConfigurations; + + private final Optional name; + + private final Optional firstMessage; + + private final Optional voicemailDetection; + + private final Optional voicemailMessage; + + private final Optional endCallMessage; + + private final Optional> endCallPhrases; + + private final Optional> metadata; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Optional analysisPlan; + + private final Optional artifactPlan; + + private final Optional messagePlan; + + private final Optional startSpeakingPlan; + + private final Optional stopSpeakingPlan; + + private final Optional monitorPlan; + + private final Optional> credentialIds; + + private final Map additionalProperties; + + private UpdateAssistantDto( + Optional transcriber, + Optional model, + Optional voice, + Optional firstMessageMode, + Optional hipaaEnabled, + Optional> clientMessages, + Optional> serverMessages, + Optional silenceTimeoutSeconds, + Optional maxDurationSeconds, + Optional backgroundSound, + Optional backchannelingEnabled, + Optional backgroundDenoisingEnabled, + Optional modelOutputInMessagesEnabled, + Optional> transportConfigurations, + Optional name, + Optional firstMessage, + Optional voicemailDetection, + Optional voicemailMessage, + Optional endCallMessage, + Optional> endCallPhrases, + Optional> metadata, + Optional serverUrl, + Optional serverUrlSecret, + Optional analysisPlan, + Optional artifactPlan, + Optional messagePlan, + Optional startSpeakingPlan, + Optional stopSpeakingPlan, + Optional monitorPlan, + Optional> credentialIds, + Map additionalProperties) { + this.transcriber = transcriber; + this.model = model; + this.voice = voice; + this.firstMessageMode = firstMessageMode; + this.hipaaEnabled = hipaaEnabled; + this.clientMessages = clientMessages; + this.serverMessages = serverMessages; + this.silenceTimeoutSeconds = silenceTimeoutSeconds; + this.maxDurationSeconds = maxDurationSeconds; + this.backgroundSound = backgroundSound; + this.backchannelingEnabled = backchannelingEnabled; + this.backgroundDenoisingEnabled = backgroundDenoisingEnabled; + this.modelOutputInMessagesEnabled = modelOutputInMessagesEnabled; + this.transportConfigurations = transportConfigurations; + this.name = name; + this.firstMessage = firstMessage; + this.voicemailDetection = voicemailDetection; + this.voicemailMessage = voicemailMessage; + this.endCallMessage = endCallMessage; + this.endCallPhrases = endCallPhrases; + this.metadata = metadata; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.analysisPlan = analysisPlan; + this.artifactPlan = artifactPlan; + this.messagePlan = messagePlan; + this.startSpeakingPlan = startSpeakingPlan; + this.stopSpeakingPlan = stopSpeakingPlan; + this.monitorPlan = monitorPlan; + this.credentialIds = credentialIds; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the options for the assistant's transcriber. + */ + @JsonProperty("transcriber") + public Optional getTranscriber() { + return transcriber; + } + + /** + * @return These are the options for the assistant's LLM. + */ + @JsonProperty("model") + public Optional getModel() { + return model; + } + + /** + * @return These are the options for the assistant's voice. + */ + @JsonProperty("voice") + public Optional getVoice() { + return voice; + } + + /** + * @return This is the mode for the first message. Default is 'assistant-speaks-first'. + *

Use:

+ *
    + *
  • 'assistant-speaks-first' to have the assistant speak first.
  • + *
  • 'assistant-waits-for-user' to have the assistant wait for the user to speak first.
  • + *
  • 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (assistant.model.messages at call start, call.messages at squad transfer points).
  • + *
+ *

@default 'assistant-speaks-first'

+ */ + @JsonProperty("firstMessageMode") + public Optional getFirstMessageMode() { + return firstMessageMode; + } + + /** + * @return When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false. + */ + @JsonProperty("hipaaEnabled") + public Optional getHipaaEnabled() { + return hipaaEnabled; + } + + /** + * @return These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema. + */ + @JsonProperty("clientMessages") + public Optional> getClientMessages() { + return clientMessages; + } + + /** + * @return These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,user-interrupted. You can check the shape of the messages in ServerMessage schema. + */ + @JsonProperty("serverMessages") + public Optional> getServerMessages() { + return serverMessages; + } + + /** + * @return How many seconds of silence to wait before ending the call. Defaults to 30. + *

@default 30

+ */ + @JsonProperty("silenceTimeoutSeconds") + public Optional getSilenceTimeoutSeconds() { + return silenceTimeoutSeconds; + } + + /** + * @return This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended. + *

@default 600 (10 minutes)

+ */ + @JsonProperty("maxDurationSeconds") + public Optional getMaxDurationSeconds() { + return maxDurationSeconds; + } + + /** + * @return This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'. + */ + @JsonProperty("backgroundSound") + public Optional getBackgroundSound() { + return backgroundSound; + } + + /** + * @return This determines whether the model says 'mhmm', 'ahem' etc. while user is speaking. + *

Default false while in beta.

+ *

@default false

+ */ + @JsonProperty("backchannelingEnabled") + public Optional getBackchannelingEnabled() { + return backchannelingEnabled; + } + + /** + * @return This enables filtering of noise and background speech while the user is talking. + *

Default false while in beta.

+ *

@default false

+ */ + @JsonProperty("backgroundDenoisingEnabled") + public Optional getBackgroundDenoisingEnabled() { + return backgroundDenoisingEnabled; + } + + /** + * @return This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech. + *

Default false while in beta.

+ *

@default false

+ */ + @JsonProperty("modelOutputInMessagesEnabled") + public Optional getModelOutputInMessagesEnabled() { + return modelOutputInMessagesEnabled; + } + + /** + * @return These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used. + */ + @JsonProperty("transportConfigurations") + public Optional> getTransportConfigurations() { + return transportConfigurations; + } + + /** + * @return This is the name of the assistant. + *

This is required when you want to transfer between assistants in a call.

+ */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). + *

If unspecified, assistant will wait for user to speak and use the model to respond once they speak.

+ */ + @JsonProperty("firstMessage") + public Optional getFirstMessage() { + return firstMessage; + } + + /** + * @return These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. + * This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached. + * You can use neither of them, one of them, or both of them. By default, Twilio built-in detection is enabled while VoicemailTool is not. + */ + @JsonProperty("voicemailDetection") + public Optional getVoicemailDetection() { + return voicemailDetection; + } + + /** + * @return This is the message that the assistant will say if the call is forwarded to voicemail. + *

If unspecified, it will hang up.

+ */ + @JsonProperty("voicemailMessage") + public Optional getVoicemailMessage() { + return voicemailMessage; + } + + /** + * @return This is the message that the assistant will say if it ends the call. + *

If unspecified, it will hang up without saying anything.

+ */ + @JsonProperty("endCallMessage") + public Optional getEndCallMessage() { + return endCallMessage; + } + + /** + * @return This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive. + */ + @JsonProperty("endCallPhrases") + public Optional> getEndCallPhrases() { + return endCallPhrases; + } + + /** + * @return This is for metadata you want to store on the assistant. + */ + @JsonProperty("metadata") + public Optional> getMetadata() { + return metadata; + } + + /** + * @return This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports. + *

All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + /** + * @return This is the plan for analysis of assistant's calls. Stored in call.analysis. + */ + @JsonProperty("analysisPlan") + public Optional getAnalysisPlan() { + return analysisPlan; + } + + /** + * @return This is the plan for artifacts generated during assistant's calls. Stored in call.artifact. + *

Note: recordingEnabled is currently at the root level. It will be moved to artifactPlan in the future, but will remain backwards compatible.

+ */ + @JsonProperty("artifactPlan") + public Optional getArtifactPlan() { + return artifactPlan; + } + + /** + * @return This is the plan for static predefined messages that can be spoken by the assistant during the call, like idleMessages. + *

Note: firstMessage, voicemailMessage, and endCallMessage are currently at the root level. They will be moved to messagePlan in the future, but will remain backwards compatible.

+ */ + @JsonProperty("messagePlan") + public Optional getMessagePlan() { + return messagePlan; + } + + /** + * @return This is the plan for when the assistant should start talking. + *

You should configure this if you're running into these issues:

+ *
    + *
  • The assistant is too slow to start talking after the customer is done speaking.
  • + *
  • The assistant is too fast to start talking after the customer is done speaking.
  • + *
  • The assistant is so fast that it's actually interrupting the customer.
  • + *
+ */ + @JsonProperty("startSpeakingPlan") + public Optional getStartSpeakingPlan() { + return startSpeakingPlan; + } + + /** + * @return This is the plan for when assistant should stop talking on customer interruption. + *

You should configure this if you're running into these issues:

+ *
    + *
  • The assistant is too slow to recognize customer's interruption.
  • + *
  • The assistant is too fast to recognize customer's interruption.
  • + *
  • The assistant is getting interrupted by phrases that are just acknowledgments.
  • + *
  • The assistant is getting interrupted by background noises.
  • + *
  • The assistant is not properly stopping -- it starts talking right after getting interrupted.
  • + *
+ */ + @JsonProperty("stopSpeakingPlan") + public Optional getStopSpeakingPlan() { + return stopSpeakingPlan; + } + + /** + * @return This is the plan for real-time monitoring of the assistant's calls. + *

Usage:

+ *
    + *
  • To enable live listening of the assistant's calls, set monitorPlan.listenEnabled to true.
  • + *
  • To enable live control of the assistant's calls, set monitorPlan.controlEnabled to true.
  • + *
+ *

Note, serverMessages, clientMessages, serverUrl and serverUrlSecret are currently at the root level but will be moved to monitorPlan in the future. Will remain backwards compatible

+ */ + @JsonProperty("monitorPlan") + public Optional getMonitorPlan() { + return monitorPlan; + } + + /** + * @return These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this. + */ + @JsonProperty("credentialIds") + public Optional> getCredentialIds() { + return credentialIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAssistantDto && equalTo((UpdateAssistantDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAssistantDto other) { + return transcriber.equals(other.transcriber) + && model.equals(other.model) + && voice.equals(other.voice) + && firstMessageMode.equals(other.firstMessageMode) + && hipaaEnabled.equals(other.hipaaEnabled) + && clientMessages.equals(other.clientMessages) + && serverMessages.equals(other.serverMessages) + && silenceTimeoutSeconds.equals(other.silenceTimeoutSeconds) + && maxDurationSeconds.equals(other.maxDurationSeconds) + && backgroundSound.equals(other.backgroundSound) + && backchannelingEnabled.equals(other.backchannelingEnabled) + && backgroundDenoisingEnabled.equals(other.backgroundDenoisingEnabled) + && modelOutputInMessagesEnabled.equals(other.modelOutputInMessagesEnabled) + && transportConfigurations.equals(other.transportConfigurations) + && name.equals(other.name) + && firstMessage.equals(other.firstMessage) + && voicemailDetection.equals(other.voicemailDetection) + && voicemailMessage.equals(other.voicemailMessage) + && endCallMessage.equals(other.endCallMessage) + && endCallPhrases.equals(other.endCallPhrases) + && metadata.equals(other.metadata) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret) + && analysisPlan.equals(other.analysisPlan) + && artifactPlan.equals(other.artifactPlan) + && messagePlan.equals(other.messagePlan) + && startSpeakingPlan.equals(other.startSpeakingPlan) + && stopSpeakingPlan.equals(other.stopSpeakingPlan) + && monitorPlan.equals(other.monitorPlan) + && credentialIds.equals(other.credentialIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.transcriber, + this.model, + this.voice, + this.firstMessageMode, + this.hipaaEnabled, + this.clientMessages, + this.serverMessages, + this.silenceTimeoutSeconds, + this.maxDurationSeconds, + this.backgroundSound, + this.backchannelingEnabled, + this.backgroundDenoisingEnabled, + this.modelOutputInMessagesEnabled, + this.transportConfigurations, + this.name, + this.firstMessage, + this.voicemailDetection, + this.voicemailMessage, + this.endCallMessage, + this.endCallPhrases, + this.metadata, + this.serverUrl, + this.serverUrlSecret, + this.analysisPlan, + this.artifactPlan, + this.messagePlan, + this.startSpeakingPlan, + this.stopSpeakingPlan, + this.monitorPlan, + this.credentialIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional transcriber = Optional.empty(); + + private Optional model = Optional.empty(); + + private Optional voice = Optional.empty(); + + private Optional firstMessageMode = Optional.empty(); + + private Optional hipaaEnabled = Optional.empty(); + + private Optional> clientMessages = Optional.empty(); + + private Optional> serverMessages = Optional.empty(); + + private Optional silenceTimeoutSeconds = Optional.empty(); + + private Optional maxDurationSeconds = Optional.empty(); + + private Optional backgroundSound = Optional.empty(); + + private Optional backchannelingEnabled = Optional.empty(); + + private Optional backgroundDenoisingEnabled = Optional.empty(); + + private Optional modelOutputInMessagesEnabled = Optional.empty(); + + private Optional> transportConfigurations = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional firstMessage = Optional.empty(); + + private Optional voicemailDetection = Optional.empty(); + + private Optional voicemailMessage = Optional.empty(); + + private Optional endCallMessage = Optional.empty(); + + private Optional> endCallPhrases = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional serverUrlSecret = Optional.empty(); + + private Optional analysisPlan = Optional.empty(); + + private Optional artifactPlan = Optional.empty(); + + private Optional messagePlan = Optional.empty(); + + private Optional startSpeakingPlan = Optional.empty(); + + private Optional stopSpeakingPlan = Optional.empty(); + + private Optional monitorPlan = Optional.empty(); + + private Optional> credentialIds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateAssistantDto other) { + transcriber(other.getTranscriber()); + model(other.getModel()); + voice(other.getVoice()); + firstMessageMode(other.getFirstMessageMode()); + hipaaEnabled(other.getHipaaEnabled()); + clientMessages(other.getClientMessages()); + serverMessages(other.getServerMessages()); + silenceTimeoutSeconds(other.getSilenceTimeoutSeconds()); + maxDurationSeconds(other.getMaxDurationSeconds()); + backgroundSound(other.getBackgroundSound()); + backchannelingEnabled(other.getBackchannelingEnabled()); + backgroundDenoisingEnabled(other.getBackgroundDenoisingEnabled()); + modelOutputInMessagesEnabled(other.getModelOutputInMessagesEnabled()); + transportConfigurations(other.getTransportConfigurations()); + name(other.getName()); + firstMessage(other.getFirstMessage()); + voicemailDetection(other.getVoicemailDetection()); + voicemailMessage(other.getVoicemailMessage()); + endCallMessage(other.getEndCallMessage()); + endCallPhrases(other.getEndCallPhrases()); + metadata(other.getMetadata()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + analysisPlan(other.getAnalysisPlan()); + artifactPlan(other.getArtifactPlan()); + messagePlan(other.getMessagePlan()); + startSpeakingPlan(other.getStartSpeakingPlan()); + stopSpeakingPlan(other.getStopSpeakingPlan()); + monitorPlan(other.getMonitorPlan()); + credentialIds(other.getCredentialIds()); + return this; + } + + @JsonSetter(value = "transcriber", nulls = Nulls.SKIP) + public Builder transcriber(Optional transcriber) { + this.transcriber = transcriber; + return this; + } + + public Builder transcriber(UpdateAssistantDtoTranscriber transcriber) { + this.transcriber = Optional.ofNullable(transcriber); + return this; + } + + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public Builder model(Optional model) { + this.model = model; + return this; + } + + public Builder model(UpdateAssistantDtoModel model) { + this.model = Optional.ofNullable(model); + return this; + } + + @JsonSetter(value = "voice", nulls = Nulls.SKIP) + public Builder voice(Optional voice) { + this.voice = voice; + return this; + } + + public Builder voice(UpdateAssistantDtoVoice voice) { + this.voice = Optional.ofNullable(voice); + return this; + } + + @JsonSetter(value = "firstMessageMode", nulls = Nulls.SKIP) + public Builder firstMessageMode(Optional firstMessageMode) { + this.firstMessageMode = firstMessageMode; + return this; + } + + public Builder firstMessageMode(UpdateAssistantDtoFirstMessageMode firstMessageMode) { + this.firstMessageMode = Optional.ofNullable(firstMessageMode); + return this; + } + + @JsonSetter(value = "hipaaEnabled", nulls = Nulls.SKIP) + public Builder hipaaEnabled(Optional hipaaEnabled) { + this.hipaaEnabled = hipaaEnabled; + return this; + } + + public Builder hipaaEnabled(Boolean hipaaEnabled) { + this.hipaaEnabled = Optional.ofNullable(hipaaEnabled); + return this; + } + + @JsonSetter(value = "clientMessages", nulls = Nulls.SKIP) + public Builder clientMessages(Optional> clientMessages) { + this.clientMessages = clientMessages; + return this; + } + + public Builder clientMessages(List clientMessages) { + this.clientMessages = Optional.ofNullable(clientMessages); + return this; + } + + @JsonSetter(value = "serverMessages", nulls = Nulls.SKIP) + public Builder serverMessages(Optional> serverMessages) { + this.serverMessages = serverMessages; + return this; + } + + public Builder serverMessages(List serverMessages) { + this.serverMessages = Optional.ofNullable(serverMessages); + return this; + } + + @JsonSetter(value = "silenceTimeoutSeconds", nulls = Nulls.SKIP) + public Builder silenceTimeoutSeconds(Optional silenceTimeoutSeconds) { + this.silenceTimeoutSeconds = silenceTimeoutSeconds; + return this; + } + + public Builder silenceTimeoutSeconds(Double silenceTimeoutSeconds) { + this.silenceTimeoutSeconds = Optional.ofNullable(silenceTimeoutSeconds); + return this; + } + + @JsonSetter(value = "maxDurationSeconds", nulls = Nulls.SKIP) + public Builder maxDurationSeconds(Optional maxDurationSeconds) { + this.maxDurationSeconds = maxDurationSeconds; + return this; + } + + public Builder maxDurationSeconds(Double maxDurationSeconds) { + this.maxDurationSeconds = Optional.ofNullable(maxDurationSeconds); + return this; + } + + @JsonSetter(value = "backgroundSound", nulls = Nulls.SKIP) + public Builder backgroundSound(Optional backgroundSound) { + this.backgroundSound = backgroundSound; + return this; + } + + public Builder backgroundSound(UpdateAssistantDtoBackgroundSound backgroundSound) { + this.backgroundSound = Optional.ofNullable(backgroundSound); + return this; + } + + @JsonSetter(value = "backchannelingEnabled", nulls = Nulls.SKIP) + public Builder backchannelingEnabled(Optional backchannelingEnabled) { + this.backchannelingEnabled = backchannelingEnabled; + return this; + } + + public Builder backchannelingEnabled(Boolean backchannelingEnabled) { + this.backchannelingEnabled = Optional.ofNullable(backchannelingEnabled); + return this; + } + + @JsonSetter(value = "backgroundDenoisingEnabled", nulls = Nulls.SKIP) + public Builder backgroundDenoisingEnabled(Optional backgroundDenoisingEnabled) { + this.backgroundDenoisingEnabled = backgroundDenoisingEnabled; + return this; + } + + public Builder backgroundDenoisingEnabled(Boolean backgroundDenoisingEnabled) { + this.backgroundDenoisingEnabled = Optional.ofNullable(backgroundDenoisingEnabled); + return this; + } + + @JsonSetter(value = "modelOutputInMessagesEnabled", nulls = Nulls.SKIP) + public Builder modelOutputInMessagesEnabled(Optional modelOutputInMessagesEnabled) { + this.modelOutputInMessagesEnabled = modelOutputInMessagesEnabled; + return this; + } + + public Builder modelOutputInMessagesEnabled(Boolean modelOutputInMessagesEnabled) { + this.modelOutputInMessagesEnabled = Optional.ofNullable(modelOutputInMessagesEnabled); + return this; + } + + @JsonSetter(value = "transportConfigurations", nulls = Nulls.SKIP) + public Builder transportConfigurations(Optional> transportConfigurations) { + this.transportConfigurations = transportConfigurations; + return this; + } + + public Builder transportConfigurations(List transportConfigurations) { + this.transportConfigurations = Optional.ofNullable(transportConfigurations); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "firstMessage", nulls = Nulls.SKIP) + public Builder firstMessage(Optional firstMessage) { + this.firstMessage = firstMessage; + return this; + } + + public Builder firstMessage(String firstMessage) { + this.firstMessage = Optional.ofNullable(firstMessage); + return this; + } + + @JsonSetter(value = "voicemailDetection", nulls = Nulls.SKIP) + public Builder voicemailDetection(Optional voicemailDetection) { + this.voicemailDetection = voicemailDetection; + return this; + } + + public Builder voicemailDetection(TwilioVoicemailDetection voicemailDetection) { + this.voicemailDetection = Optional.ofNullable(voicemailDetection); + return this; + } + + @JsonSetter(value = "voicemailMessage", nulls = Nulls.SKIP) + public Builder voicemailMessage(Optional voicemailMessage) { + this.voicemailMessage = voicemailMessage; + return this; + } + + public Builder voicemailMessage(String voicemailMessage) { + this.voicemailMessage = Optional.ofNullable(voicemailMessage); + return this; + } + + @JsonSetter(value = "endCallMessage", nulls = Nulls.SKIP) + public Builder endCallMessage(Optional endCallMessage) { + this.endCallMessage = endCallMessage; + return this; + } + + public Builder endCallMessage(String endCallMessage) { + this.endCallMessage = Optional.ofNullable(endCallMessage); + return this; + } + + @JsonSetter(value = "endCallPhrases", nulls = Nulls.SKIP) + public Builder endCallPhrases(Optional> endCallPhrases) { + this.endCallPhrases = endCallPhrases; + return this; + } + + public Builder endCallPhrases(List endCallPhrases) { + this.endCallPhrases = Optional.ofNullable(endCallPhrases); + return this; + } + + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public Builder serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + public Builder serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public Builder serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + public Builder serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @JsonSetter(value = "analysisPlan", nulls = Nulls.SKIP) + public Builder analysisPlan(Optional analysisPlan) { + this.analysisPlan = analysisPlan; + return this; + } + + public Builder analysisPlan(AnalysisPlan analysisPlan) { + this.analysisPlan = Optional.ofNullable(analysisPlan); + return this; + } + + @JsonSetter(value = "artifactPlan", nulls = Nulls.SKIP) + public Builder artifactPlan(Optional artifactPlan) { + this.artifactPlan = artifactPlan; + return this; + } + + public Builder artifactPlan(ArtifactPlan artifactPlan) { + this.artifactPlan = Optional.ofNullable(artifactPlan); + return this; + } + + @JsonSetter(value = "messagePlan", nulls = Nulls.SKIP) + public Builder messagePlan(Optional messagePlan) { + this.messagePlan = messagePlan; + return this; + } + + public Builder messagePlan(MessagePlan messagePlan) { + this.messagePlan = Optional.ofNullable(messagePlan); + return this; + } + + @JsonSetter(value = "startSpeakingPlan", nulls = Nulls.SKIP) + public Builder startSpeakingPlan(Optional startSpeakingPlan) { + this.startSpeakingPlan = startSpeakingPlan; + return this; + } + + public Builder startSpeakingPlan(StartSpeakingPlan startSpeakingPlan) { + this.startSpeakingPlan = Optional.ofNullable(startSpeakingPlan); + return this; + } + + @JsonSetter(value = "stopSpeakingPlan", nulls = Nulls.SKIP) + public Builder stopSpeakingPlan(Optional stopSpeakingPlan) { + this.stopSpeakingPlan = stopSpeakingPlan; + return this; + } + + public Builder stopSpeakingPlan(StopSpeakingPlan stopSpeakingPlan) { + this.stopSpeakingPlan = Optional.ofNullable(stopSpeakingPlan); + return this; + } + + @JsonSetter(value = "monitorPlan", nulls = Nulls.SKIP) + public Builder monitorPlan(Optional monitorPlan) { + this.monitorPlan = monitorPlan; + return this; + } + + public Builder monitorPlan(MonitorPlan monitorPlan) { + this.monitorPlan = Optional.ofNullable(monitorPlan); + return this; + } + + @JsonSetter(value = "credentialIds", nulls = Nulls.SKIP) + public Builder credentialIds(Optional> credentialIds) { + this.credentialIds = credentialIds; + return this; + } + + public Builder credentialIds(List credentialIds) { + this.credentialIds = Optional.ofNullable(credentialIds); + return this; + } + + public UpdateAssistantDto build() { + return new UpdateAssistantDto( + transcriber, + model, + voice, + firstMessageMode, + hipaaEnabled, + clientMessages, + serverMessages, + silenceTimeoutSeconds, + maxDurationSeconds, + backgroundSound, + backchannelingEnabled, + backgroundDenoisingEnabled, + modelOutputInMessagesEnabled, + transportConfigurations, + name, + firstMessage, + voicemailDetection, + voicemailMessage, + endCallMessage, + endCallPhrases, + metadata, + serverUrl, + serverUrlSecret, + analysisPlan, + artifactPlan, + messagePlan, + startSpeakingPlan, + stopSpeakingPlan, + monitorPlan, + credentialIds, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoBackgroundSound.java b/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoBackgroundSound.java new file mode 100644 index 0000000..20aa928 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoBackgroundSound.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.assistants.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum UpdateAssistantDtoBackgroundSound { + OFF("off"), + + OFFICE("office"); + + private final String value; + + UpdateAssistantDtoBackgroundSound(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoClientMessagesItem.java b/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoClientMessagesItem.java new file mode 100644 index 0000000..b0de6ca --- /dev/null +++ b/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoClientMessagesItem.java @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.assistants.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum UpdateAssistantDtoClientMessagesItem { + CONVERSATION_UPDATE("conversation-update"), + + FUNCTION_CALL("function-call"), + + FUNCTION_CALL_RESULT("function-call-result"), + + HANG("hang"), + + LANGUAGE_CHANGED("language-changed"), + + METADATA("metadata"), + + MODEL_OUTPUT("model-output"), + + SPEECH_UPDATE("speech-update"), + + STATUS_UPDATE("status-update"), + + TRANSCRIPT("transcript"), + + TOOL_CALLS("tool-calls"), + + TOOL_CALLS_RESULT("tool-calls-result"), + + USER_INTERRUPTED("user-interrupted"), + + VOICE_INPUT("voice-input"); + + private final String value; + + UpdateAssistantDtoClientMessagesItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoFirstMessageMode.java b/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoFirstMessageMode.java new file mode 100644 index 0000000..339b40b --- /dev/null +++ b/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoFirstMessageMode.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.assistants.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum UpdateAssistantDtoFirstMessageMode { + ASSISTANT_SPEAKS_FIRST("assistant-speaks-first"), + + ASSISTANT_SPEAKS_FIRST_WITH_MODEL_GENERATED_MESSAGE("assistant-speaks-first-with-model-generated-message"), + + ASSISTANT_WAITS_FOR_USER("assistant-waits-for-user"); + + private final String value; + + UpdateAssistantDtoFirstMessageMode(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoModel.java b/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoModel.java new file mode 100644 index 0000000..397ba97 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoModel.java @@ -0,0 +1,661 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.assistants.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.AnthropicModel; +import com.vapi.api.types.AnyscaleModel; +import com.vapi.api.types.CustomLlmModel; +import com.vapi.api.types.DeepInfraModel; +import com.vapi.api.types.GroqModel; +import com.vapi.api.types.OpenAiModel; +import com.vapi.api.types.OpenRouterModel; +import com.vapi.api.types.PerplexityAiModel; +import com.vapi.api.types.TogetherAiModel; +import com.vapi.api.types.VapiModel; +import java.util.Objects; +import java.util.Optional; + +public final class UpdateAssistantDtoModel { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private UpdateAssistantDtoModel(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static UpdateAssistantDtoModel anyscale(AnyscaleModel value) { + return new UpdateAssistantDtoModel(new AnyscaleValue(value)); + } + + public static UpdateAssistantDtoModel anthropic(AnthropicModel value) { + return new UpdateAssistantDtoModel(new AnthropicValue(value)); + } + + public static UpdateAssistantDtoModel customLlm(CustomLlmModel value) { + return new UpdateAssistantDtoModel(new CustomLlmValue(value)); + } + + public static UpdateAssistantDtoModel deepinfra(DeepInfraModel value) { + return new UpdateAssistantDtoModel(new DeepinfraValue(value)); + } + + public static UpdateAssistantDtoModel groq(GroqModel value) { + return new UpdateAssistantDtoModel(new GroqValue(value)); + } + + public static UpdateAssistantDtoModel openai(OpenAiModel value) { + return new UpdateAssistantDtoModel(new OpenaiValue(value)); + } + + public static UpdateAssistantDtoModel openrouter(OpenRouterModel value) { + return new UpdateAssistantDtoModel(new OpenrouterValue(value)); + } + + public static UpdateAssistantDtoModel perplexityAi(PerplexityAiModel value) { + return new UpdateAssistantDtoModel(new PerplexityAiValue(value)); + } + + public static UpdateAssistantDtoModel togetherAi(TogetherAiModel value) { + return new UpdateAssistantDtoModel(new TogetherAiValue(value)); + } + + public static UpdateAssistantDtoModel vapi(VapiModel value) { + return new UpdateAssistantDtoModel(new VapiValue(value)); + } + + public boolean isAnyscale() { + return value instanceof AnyscaleValue; + } + + public boolean isAnthropic() { + return value instanceof AnthropicValue; + } + + public boolean isCustomLlm() { + return value instanceof CustomLlmValue; + } + + public boolean isDeepinfra() { + return value instanceof DeepinfraValue; + } + + public boolean isGroq() { + return value instanceof GroqValue; + } + + public boolean isOpenai() { + return value instanceof OpenaiValue; + } + + public boolean isOpenrouter() { + return value instanceof OpenrouterValue; + } + + public boolean isPerplexityAi() { + return value instanceof PerplexityAiValue; + } + + public boolean isTogetherAi() { + return value instanceof TogetherAiValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAnyscale() { + if (isAnyscale()) { + return Optional.of(((AnyscaleValue) value).value); + } + return Optional.empty(); + } + + public Optional getAnthropic() { + if (isAnthropic()) { + return Optional.of(((AnthropicValue) value).value); + } + return Optional.empty(); + } + + public Optional getCustomLlm() { + if (isCustomLlm()) { + return Optional.of(((CustomLlmValue) value).value); + } + return Optional.empty(); + } + + public Optional getDeepinfra() { + if (isDeepinfra()) { + return Optional.of(((DeepinfraValue) value).value); + } + return Optional.empty(); + } + + public Optional getGroq() { + if (isGroq()) { + return Optional.of(((GroqValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenai() { + if (isOpenai()) { + return Optional.of(((OpenaiValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenrouter() { + if (isOpenrouter()) { + return Optional.of(((OpenrouterValue) value).value); + } + return Optional.empty(); + } + + public Optional getPerplexityAi() { + if (isPerplexityAi()) { + return Optional.of(((PerplexityAiValue) value).value); + } + return Optional.empty(); + } + + public Optional getTogetherAi() { + if (isTogetherAi()) { + return Optional.of(((TogetherAiValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAnyscale(AnyscaleModel anyscale); + + T visitAnthropic(AnthropicModel anthropic); + + T visitCustomLlm(CustomLlmModel customLlm); + + T visitDeepinfra(DeepInfraModel deepinfra); + + T visitGroq(GroqModel groq); + + T visitOpenai(OpenAiModel openai); + + T visitOpenrouter(OpenRouterModel openrouter); + + T visitPerplexityAi(PerplexityAiModel perplexityAi); + + T visitTogetherAi(TogetherAiModel togetherAi); + + T visitVapi(VapiModel vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AnyscaleValue.class), + @JsonSubTypes.Type(AnthropicValue.class), + @JsonSubTypes.Type(CustomLlmValue.class), + @JsonSubTypes.Type(DeepinfraValue.class), + @JsonSubTypes.Type(GroqValue.class), + @JsonSubTypes.Type(OpenaiValue.class), + @JsonSubTypes.Type(OpenrouterValue.class), + @JsonSubTypes.Type(PerplexityAiValue.class), + @JsonSubTypes.Type(TogetherAiValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("anyscale") + private static final class AnyscaleValue implements Value { + @JsonUnwrapped + private AnyscaleModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AnyscaleValue() {} + + private AnyscaleValue(AnyscaleModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAnyscale(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnyscaleValue && equalTo((AnyscaleValue) other); + } + + private boolean equalTo(AnyscaleValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("anthropic") + private static final class AnthropicValue implements Value { + @JsonUnwrapped + private AnthropicModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AnthropicValue() {} + + private AnthropicValue(AnthropicModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAnthropic(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnthropicValue && equalTo((AnthropicValue) other); + } + + private boolean equalTo(AnthropicValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("custom-llm") + private static final class CustomLlmValue implements Value { + @JsonUnwrapped + private CustomLlmModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CustomLlmValue() {} + + private CustomLlmValue(CustomLlmModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCustomLlm(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CustomLlmValue && equalTo((CustomLlmValue) other); + } + + private boolean equalTo(CustomLlmValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("deepinfra") + private static final class DeepinfraValue implements Value { + @JsonUnwrapped + private DeepInfraModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepinfraValue() {} + + private DeepinfraValue(DeepInfraModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDeepinfra(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepinfraValue && equalTo((DeepinfraValue) other); + } + + private boolean equalTo(DeepinfraValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("groq") + private static final class GroqValue implements Value { + @JsonUnwrapped + private GroqModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GroqValue() {} + + private GroqValue(GroqModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGroq(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GroqValue && equalTo((GroqValue) other); + } + + private boolean equalTo(GroqValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("openai") + private static final class OpenaiValue implements Value { + @JsonUnwrapped + private OpenAiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenaiValue() {} + + private OpenaiValue(OpenAiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOpenai(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenaiValue && equalTo((OpenaiValue) other); + } + + private boolean equalTo(OpenaiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("openrouter") + private static final class OpenrouterValue implements Value { + @JsonUnwrapped + private OpenRouterModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenrouterValue() {} + + private OpenrouterValue(OpenRouterModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOpenrouter(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenrouterValue && equalTo((OpenrouterValue) other); + } + + private boolean equalTo(OpenrouterValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("perplexity-ai") + private static final class PerplexityAiValue implements Value { + @JsonUnwrapped + private PerplexityAiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private PerplexityAiValue() {} + + private PerplexityAiValue(PerplexityAiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitPerplexityAi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PerplexityAiValue && equalTo((PerplexityAiValue) other); + } + + private boolean equalTo(PerplexityAiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("together-ai") + private static final class TogetherAiValue implements Value { + @JsonUnwrapped + private TogetherAiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TogetherAiValue() {} + + private TogetherAiValue(TogetherAiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTogetherAi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TogetherAiValue && equalTo((TogetherAiValue) other); + } + + private boolean equalTo(TogetherAiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private VapiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(VapiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoModel{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoServerMessagesItem.java b/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoServerMessagesItem.java new file mode 100644 index 0000000..8c6a121 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoServerMessagesItem.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.assistants.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum UpdateAssistantDtoServerMessagesItem { + CONVERSATION_UPDATE("conversation-update"), + + END_OF_CALL_REPORT("end-of-call-report"), + + FUNCTION_CALL("function-call"), + + HANG("hang"), + + LANGUAGE_CHANGED("language-changed"), + + MODEL_OUTPUT("model-output"), + + PHONE_CALL_CONTROL("phone-call-control"), + + SPEECH_UPDATE("speech-update"), + + STATUS_UPDATE("status-update"), + + TRANSCRIPT("transcript"), + + TOOL_CALLS("tool-calls"), + + TRANSFER_DESTINATION_REQUEST("transfer-destination-request"), + + TRANSFER_UPDATE("transfer-update"), + + USER_INTERRUPTED("user-interrupted"), + + VOICE_INPUT("voice-input"); + + private final String value; + + UpdateAssistantDtoServerMessagesItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoTranscriber.java b/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoTranscriber.java new file mode 100644 index 0000000..e6ad82a --- /dev/null +++ b/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoTranscriber.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.assistants.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.DeepgramTranscriber; +import com.vapi.api.types.GladiaTranscriber; +import com.vapi.api.types.TalkscriberTranscriber; +import java.util.Objects; +import java.util.Optional; + +public final class UpdateAssistantDtoTranscriber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private UpdateAssistantDtoTranscriber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static UpdateAssistantDtoTranscriber deepgram(DeepgramTranscriber value) { + return new UpdateAssistantDtoTranscriber(new DeepgramValue(value)); + } + + public static UpdateAssistantDtoTranscriber gladia(GladiaTranscriber value) { + return new UpdateAssistantDtoTranscriber(new GladiaValue(value)); + } + + public static UpdateAssistantDtoTranscriber talkscriber(TalkscriberTranscriber value) { + return new UpdateAssistantDtoTranscriber(new TalkscriberValue(value)); + } + + public boolean isDeepgram() { + return value instanceof DeepgramValue; + } + + public boolean isGladia() { + return value instanceof GladiaValue; + } + + public boolean isTalkscriber() { + return value instanceof TalkscriberValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDeepgram() { + if (isDeepgram()) { + return Optional.of(((DeepgramValue) value).value); + } + return Optional.empty(); + } + + public Optional getGladia() { + if (isGladia()) { + return Optional.of(((GladiaValue) value).value); + } + return Optional.empty(); + } + + public Optional getTalkscriber() { + if (isTalkscriber()) { + return Optional.of(((TalkscriberValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDeepgram(DeepgramTranscriber deepgram); + + T visitGladia(GladiaTranscriber gladia); + + T visitTalkscriber(TalkscriberTranscriber talkscriber); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DeepgramValue.class), + @JsonSubTypes.Type(GladiaValue.class), + @JsonSubTypes.Type(TalkscriberValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("deepgram") + private static final class DeepgramValue implements Value { + @JsonUnwrapped + private DeepgramTranscriber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepgramValue() {} + + private DeepgramValue(DeepgramTranscriber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDeepgram(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepgramValue && equalTo((DeepgramValue) other); + } + + private boolean equalTo(DeepgramValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoTranscriber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("gladia") + private static final class GladiaValue implements Value { + @JsonUnwrapped + private GladiaTranscriber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GladiaValue() {} + + private GladiaValue(GladiaTranscriber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGladia(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GladiaValue && equalTo((GladiaValue) other); + } + + private boolean equalTo(GladiaValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoTranscriber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("talkscriber") + private static final class TalkscriberValue implements Value { + @JsonUnwrapped + private TalkscriberTranscriber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TalkscriberValue() {} + + private TalkscriberValue(TalkscriberTranscriber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTalkscriber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TalkscriberValue && equalTo((TalkscriberValue) other); + } + + private boolean equalTo(TalkscriberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoTranscriber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoTranscriber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoVoice.java b/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoVoice.java new file mode 100644 index 0000000..01987c7 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/assistants/types/UpdateAssistantDtoVoice.java @@ -0,0 +1,604 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.assistants.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.AzureVoice; +import com.vapi.api.types.CartesiaVoice; +import com.vapi.api.types.DeepgramVoice; +import com.vapi.api.types.ElevenLabsVoice; +import com.vapi.api.types.LmntVoice; +import com.vapi.api.types.NeetsVoice; +import com.vapi.api.types.OpenAiVoice; +import com.vapi.api.types.PlayHtVoice; +import com.vapi.api.types.RimeAiVoice; +import java.util.Objects; +import java.util.Optional; + +public final class UpdateAssistantDtoVoice { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private UpdateAssistantDtoVoice(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static UpdateAssistantDtoVoice azure(AzureVoice value) { + return new UpdateAssistantDtoVoice(new AzureValue(value)); + } + + public static UpdateAssistantDtoVoice cartesia(CartesiaVoice value) { + return new UpdateAssistantDtoVoice(new CartesiaValue(value)); + } + + public static UpdateAssistantDtoVoice deepgram(DeepgramVoice value) { + return new UpdateAssistantDtoVoice(new DeepgramValue(value)); + } + + public static UpdateAssistantDtoVoice _11Labs(ElevenLabsVoice value) { + return new UpdateAssistantDtoVoice(new _11LabsValue(value)); + } + + public static UpdateAssistantDtoVoice lmnt(LmntVoice value) { + return new UpdateAssistantDtoVoice(new LmntValue(value)); + } + + public static UpdateAssistantDtoVoice neets(NeetsVoice value) { + return new UpdateAssistantDtoVoice(new NeetsValue(value)); + } + + public static UpdateAssistantDtoVoice openai(OpenAiVoice value) { + return new UpdateAssistantDtoVoice(new OpenaiValue(value)); + } + + public static UpdateAssistantDtoVoice playht(PlayHtVoice value) { + return new UpdateAssistantDtoVoice(new PlayhtValue(value)); + } + + public static UpdateAssistantDtoVoice rimeAi(RimeAiVoice value) { + return new UpdateAssistantDtoVoice(new RimeAiValue(value)); + } + + public boolean isAzure() { + return value instanceof AzureValue; + } + + public boolean isCartesia() { + return value instanceof CartesiaValue; + } + + public boolean isDeepgram() { + return value instanceof DeepgramValue; + } + + public boolean is11Labs() { + return value instanceof _11LabsValue; + } + + public boolean isLmnt() { + return value instanceof LmntValue; + } + + public boolean isNeets() { + return value instanceof NeetsValue; + } + + public boolean isOpenai() { + return value instanceof OpenaiValue; + } + + public boolean isPlayht() { + return value instanceof PlayhtValue; + } + + public boolean isRimeAi() { + return value instanceof RimeAiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAzure() { + if (isAzure()) { + return Optional.of(((AzureValue) value).value); + } + return Optional.empty(); + } + + public Optional getCartesia() { + if (isCartesia()) { + return Optional.of(((CartesiaValue) value).value); + } + return Optional.empty(); + } + + public Optional getDeepgram() { + if (isDeepgram()) { + return Optional.of(((DeepgramValue) value).value); + } + return Optional.empty(); + } + + public Optional get11Labs() { + if (is11Labs()) { + return Optional.of(((_11LabsValue) value).value); + } + return Optional.empty(); + } + + public Optional getLmnt() { + if (isLmnt()) { + return Optional.of(((LmntValue) value).value); + } + return Optional.empty(); + } + + public Optional getNeets() { + if (isNeets()) { + return Optional.of(((NeetsValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenai() { + if (isOpenai()) { + return Optional.of(((OpenaiValue) value).value); + } + return Optional.empty(); + } + + public Optional getPlayht() { + if (isPlayht()) { + return Optional.of(((PlayhtValue) value).value); + } + return Optional.empty(); + } + + public Optional getRimeAi() { + if (isRimeAi()) { + return Optional.of(((RimeAiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAzure(AzureVoice azure); + + T visitCartesia(CartesiaVoice cartesia); + + T visitDeepgram(DeepgramVoice deepgram); + + T visit11Labs(ElevenLabsVoice _11Labs); + + T visitLmnt(LmntVoice lmnt); + + T visitNeets(NeetsVoice neets); + + T visitOpenai(OpenAiVoice openai); + + T visitPlayht(PlayHtVoice playht); + + T visitRimeAi(RimeAiVoice rimeAi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AzureValue.class), + @JsonSubTypes.Type(CartesiaValue.class), + @JsonSubTypes.Type(DeepgramValue.class), + @JsonSubTypes.Type(_11LabsValue.class), + @JsonSubTypes.Type(LmntValue.class), + @JsonSubTypes.Type(NeetsValue.class), + @JsonSubTypes.Type(OpenaiValue.class), + @JsonSubTypes.Type(PlayhtValue.class), + @JsonSubTypes.Type(RimeAiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("azure") + private static final class AzureValue implements Value { + @JsonUnwrapped + private AzureVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AzureValue() {} + + private AzureValue(AzureVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAzure(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AzureValue && equalTo((AzureValue) other); + } + + private boolean equalTo(AzureValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("cartesia") + private static final class CartesiaValue implements Value { + @JsonUnwrapped + private CartesiaVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CartesiaValue() {} + + private CartesiaValue(CartesiaVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCartesia(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CartesiaValue && equalTo((CartesiaValue) other); + } + + private boolean equalTo(CartesiaValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("deepgram") + private static final class DeepgramValue implements Value { + @JsonUnwrapped + private DeepgramVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepgramValue() {} + + private DeepgramValue(DeepgramVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDeepgram(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepgramValue && equalTo((DeepgramValue) other); + } + + private boolean equalTo(DeepgramValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("11labs") + private static final class _11LabsValue implements Value { + @JsonUnwrapped + private ElevenLabsVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _11LabsValue() {} + + private _11LabsValue(ElevenLabsVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visit11Labs(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _11LabsValue && equalTo((_11LabsValue) other); + } + + private boolean equalTo(_11LabsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("lmnt") + private static final class LmntValue implements Value { + @JsonUnwrapped + private LmntVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private LmntValue() {} + + private LmntValue(LmntVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitLmnt(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LmntValue && equalTo((LmntValue) other); + } + + private boolean equalTo(LmntValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("neets") + private static final class NeetsValue implements Value { + @JsonUnwrapped + private NeetsVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NeetsValue() {} + + private NeetsValue(NeetsVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNeets(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NeetsValue && equalTo((NeetsValue) other); + } + + private boolean equalTo(NeetsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("openai") + private static final class OpenaiValue implements Value { + @JsonUnwrapped + private OpenAiVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenaiValue() {} + + private OpenaiValue(OpenAiVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOpenai(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenaiValue && equalTo((OpenaiValue) other); + } + + private boolean equalTo(OpenaiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("playht") + private static final class PlayhtValue implements Value { + @JsonUnwrapped + private PlayHtVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private PlayhtValue() {} + + private PlayhtValue(PlayHtVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitPlayht(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlayhtValue && equalTo((PlayhtValue) other); + } + + private boolean equalTo(PlayhtValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("rime-ai") + private static final class RimeAiValue implements Value { + @JsonUnwrapped + private RimeAiVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RimeAiValue() {} + + private RimeAiValue(RimeAiVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRimeAi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RimeAiValue && equalTo((RimeAiValue) other); + } + + private boolean equalTo(RimeAiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateAssistantDtoVoice{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/blocks/BlocksClient.java b/src/main/java/com/vapi/api/resources/blocks/BlocksClient.java new file mode 100644 index 0000000..230c1a3 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/blocks/BlocksClient.java @@ -0,0 +1,268 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.blocks; + +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.blocks.requests.BlocksListRequest; +import com.vapi.api.resources.blocks.requests.UpdateBlockDto; +import com.vapi.api.resources.blocks.types.BlocksCreateRequest; +import com.vapi.api.resources.blocks.types.BlocksCreateResponse; +import com.vapi.api.resources.blocks.types.BlocksDeleteResponse; +import com.vapi.api.resources.blocks.types.BlocksGetResponse; +import com.vapi.api.resources.blocks.types.BlocksListResponseItem; +import com.vapi.api.resources.blocks.types.BlocksUpdateResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class BlocksClient { + protected final ClientOptions clientOptions; + + public BlocksClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public List list() { + return list(BlocksListRequest.builder().build()); + } + + public List list(BlocksListRequest request) { + return list(request, null); + } + + public List list(BlocksListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("block"); + if (request.getLimit().isPresent()) { + httpUrl.addQueryParameter("limit", request.getLimit().get().toString()); + } + if (request.getCreatedAtGt().isPresent()) { + httpUrl.addQueryParameter( + "createdAtGt", request.getCreatedAtGt().get().toString()); + } + if (request.getCreatedAtLt().isPresent()) { + httpUrl.addQueryParameter( + "createdAtLt", request.getCreatedAtLt().get().toString()); + } + if (request.getCreatedAtGe().isPresent()) { + httpUrl.addQueryParameter( + "createdAtGe", request.getCreatedAtGe().get().toString()); + } + if (request.getCreatedAtLe().isPresent()) { + httpUrl.addQueryParameter( + "createdAtLe", request.getCreatedAtLe().get().toString()); + } + if (request.getUpdatedAtGt().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtGt", request.getUpdatedAtGt().get().toString()); + } + if (request.getUpdatedAtLt().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtLt", request.getUpdatedAtLt().get().toString()); + } + if (request.getUpdatedAtGe().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtGe", request.getUpdatedAtGe().get().toString()); + } + if (request.getUpdatedAtLe().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtLe", request.getUpdatedAtLe().get().toString()); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public BlocksCreateResponse create(BlocksCreateRequest request) { + return create(request, null); + } + + public BlocksCreateResponse create(BlocksCreateRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("block") + .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) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), BlocksCreateResponse.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public BlocksGetResponse get(String id) { + return get(id, null); + } + + public BlocksGetResponse get(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("block") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), BlocksGetResponse.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public BlocksDeleteResponse delete(String id) { + return delete(id, null); + } + + public BlocksDeleteResponse delete(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("block") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), BlocksDeleteResponse.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public BlocksUpdateResponse update(String id) { + return update(id, UpdateBlockDto.builder().build()); + } + + public BlocksUpdateResponse update(String id, UpdateBlockDto request) { + return update(id, request, null); + } + + public BlocksUpdateResponse update(String id, UpdateBlockDto request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("block") + .addPathSegment(id) + .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("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), BlocksUpdateResponse.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/blocks/requests/BlocksListRequest.java b/src/main/java/com/vapi/api/resources/blocks/requests/BlocksListRequest.java new file mode 100644 index 0000000..f549dd5 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/blocks/requests/BlocksListRequest.java @@ -0,0 +1,336 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.blocks.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BlocksListRequest.Builder.class) +public final class BlocksListRequest { + private final Optional limit; + + private final Optional createdAtGt; + + private final Optional createdAtLt; + + private final Optional createdAtGe; + + private final Optional createdAtLe; + + private final Optional updatedAtGt; + + private final Optional updatedAtLt; + + private final Optional updatedAtGe; + + private final Optional updatedAtLe; + + private final Map additionalProperties; + + private BlocksListRequest( + Optional limit, + Optional createdAtGt, + Optional createdAtLt, + Optional createdAtGe, + Optional createdAtLe, + Optional updatedAtGt, + Optional updatedAtLt, + Optional updatedAtGe, + Optional updatedAtLe, + Map additionalProperties) { + this.limit = limit; + this.createdAtGt = createdAtGt; + this.createdAtLt = createdAtLt; + this.createdAtGe = createdAtGe; + this.createdAtLe = createdAtLe; + this.updatedAtGt = updatedAtGt; + this.updatedAtLt = updatedAtLt; + this.updatedAtGe = updatedAtGe; + this.updatedAtLe = updatedAtLe; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the maximum number of items to return. Defaults to 100. + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return This will return items where the createdAt is greater than the specified value. + */ + @JsonProperty("createdAtGt") + public Optional getCreatedAtGt() { + return createdAtGt; + } + + /** + * @return This will return items where the createdAt is less than the specified value. + */ + @JsonProperty("createdAtLt") + public Optional getCreatedAtLt() { + return createdAtLt; + } + + /** + * @return This will return items where the createdAt is greater than or equal to the specified value. + */ + @JsonProperty("createdAtGe") + public Optional getCreatedAtGe() { + return createdAtGe; + } + + /** + * @return This will return items where the createdAt is less than or equal to the specified value. + */ + @JsonProperty("createdAtLe") + public Optional getCreatedAtLe() { + return createdAtLe; + } + + /** + * @return This will return items where the updatedAt is greater than the specified value. + */ + @JsonProperty("updatedAtGt") + public Optional getUpdatedAtGt() { + return updatedAtGt; + } + + /** + * @return This will return items where the updatedAt is less than the specified value. + */ + @JsonProperty("updatedAtLt") + public Optional getUpdatedAtLt() { + return updatedAtLt; + } + + /** + * @return This will return items where the updatedAt is greater than or equal to the specified value. + */ + @JsonProperty("updatedAtGe") + public Optional getUpdatedAtGe() { + return updatedAtGe; + } + + /** + * @return This will return items where the updatedAt is less than or equal to the specified value. + */ + @JsonProperty("updatedAtLe") + public Optional getUpdatedAtLe() { + return updatedAtLe; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlocksListRequest && equalTo((BlocksListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BlocksListRequest other) { + return limit.equals(other.limit) + && createdAtGt.equals(other.createdAtGt) + && createdAtLt.equals(other.createdAtLt) + && createdAtGe.equals(other.createdAtGe) + && createdAtLe.equals(other.createdAtLe) + && updatedAtGt.equals(other.updatedAtGt) + && updatedAtLt.equals(other.updatedAtLt) + && updatedAtGe.equals(other.updatedAtGe) + && updatedAtLe.equals(other.updatedAtLe); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.limit, + this.createdAtGt, + this.createdAtLt, + this.createdAtGe, + this.createdAtLe, + this.updatedAtGt, + this.updatedAtLt, + this.updatedAtGe, + this.updatedAtLe); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional limit = Optional.empty(); + + private Optional createdAtGt = Optional.empty(); + + private Optional createdAtLt = Optional.empty(); + + private Optional createdAtGe = Optional.empty(); + + private Optional createdAtLe = Optional.empty(); + + private Optional updatedAtGt = Optional.empty(); + + private Optional updatedAtLt = Optional.empty(); + + private Optional updatedAtGe = Optional.empty(); + + private Optional updatedAtLe = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(BlocksListRequest other) { + limit(other.getLimit()); + createdAtGt(other.getCreatedAtGt()); + createdAtLt(other.getCreatedAtLt()); + createdAtGe(other.getCreatedAtGe()); + createdAtLe(other.getCreatedAtLe()); + updatedAtGt(other.getUpdatedAtGt()); + updatedAtLt(other.getUpdatedAtLt()); + updatedAtGe(other.getUpdatedAtGe()); + updatedAtLe(other.getUpdatedAtLe()); + return this; + } + + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Double limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + @JsonSetter(value = "createdAtGt", nulls = Nulls.SKIP) + public Builder createdAtGt(Optional createdAtGt) { + this.createdAtGt = createdAtGt; + return this; + } + + public Builder createdAtGt(OffsetDateTime createdAtGt) { + this.createdAtGt = Optional.ofNullable(createdAtGt); + return this; + } + + @JsonSetter(value = "createdAtLt", nulls = Nulls.SKIP) + public Builder createdAtLt(Optional createdAtLt) { + this.createdAtLt = createdAtLt; + return this; + } + + public Builder createdAtLt(OffsetDateTime createdAtLt) { + this.createdAtLt = Optional.ofNullable(createdAtLt); + return this; + } + + @JsonSetter(value = "createdAtGe", nulls = Nulls.SKIP) + public Builder createdAtGe(Optional createdAtGe) { + this.createdAtGe = createdAtGe; + return this; + } + + public Builder createdAtGe(OffsetDateTime createdAtGe) { + this.createdAtGe = Optional.ofNullable(createdAtGe); + return this; + } + + @JsonSetter(value = "createdAtLe", nulls = Nulls.SKIP) + public Builder createdAtLe(Optional createdAtLe) { + this.createdAtLe = createdAtLe; + return this; + } + + public Builder createdAtLe(OffsetDateTime createdAtLe) { + this.createdAtLe = Optional.ofNullable(createdAtLe); + return this; + } + + @JsonSetter(value = "updatedAtGt", nulls = Nulls.SKIP) + public Builder updatedAtGt(Optional updatedAtGt) { + this.updatedAtGt = updatedAtGt; + return this; + } + + public Builder updatedAtGt(OffsetDateTime updatedAtGt) { + this.updatedAtGt = Optional.ofNullable(updatedAtGt); + return this; + } + + @JsonSetter(value = "updatedAtLt", nulls = Nulls.SKIP) + public Builder updatedAtLt(Optional updatedAtLt) { + this.updatedAtLt = updatedAtLt; + return this; + } + + public Builder updatedAtLt(OffsetDateTime updatedAtLt) { + this.updatedAtLt = Optional.ofNullable(updatedAtLt); + return this; + } + + @JsonSetter(value = "updatedAtGe", nulls = Nulls.SKIP) + public Builder updatedAtGe(Optional updatedAtGe) { + this.updatedAtGe = updatedAtGe; + return this; + } + + public Builder updatedAtGe(OffsetDateTime updatedAtGe) { + this.updatedAtGe = Optional.ofNullable(updatedAtGe); + return this; + } + + @JsonSetter(value = "updatedAtLe", nulls = Nulls.SKIP) + public Builder updatedAtLe(Optional updatedAtLe) { + this.updatedAtLe = updatedAtLe; + return this; + } + + public Builder updatedAtLe(OffsetDateTime updatedAtLe) { + this.updatedAtLe = Optional.ofNullable(updatedAtLe); + return this; + } + + public BlocksListRequest build() { + return new BlocksListRequest( + limit, + createdAtGt, + createdAtLt, + createdAtGe, + createdAtLe, + updatedAtGt, + updatedAtLt, + updatedAtGe, + updatedAtLe, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/blocks/requests/UpdateBlockDto.java b/src/main/java/com/vapi/api/resources/blocks/requests/UpdateBlockDto.java new file mode 100644 index 0000000..8c029ae --- /dev/null +++ b/src/main/java/com/vapi/api/resources/blocks/requests/UpdateBlockDto.java @@ -0,0 +1,340 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.blocks.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import com.vapi.api.resources.blocks.types.UpdateBlockDtoMessagesItem; +import com.vapi.api.resources.blocks.types.UpdateBlockDtoStepsItem; +import com.vapi.api.resources.blocks.types.UpdateBlockDtoTool; +import com.vapi.api.types.JsonSchema; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateBlockDto.Builder.class) +public final class UpdateBlockDto { + private final Optional> messages; + + private final Optional inputSchema; + + private final Optional outputSchema; + + private final Optional tool; + + private final Optional> steps; + + private final Optional name; + + private final Optional instruction; + + private final Optional toolId; + + private final Map additionalProperties; + + private UpdateBlockDto( + Optional> messages, + Optional inputSchema, + Optional outputSchema, + Optional tool, + Optional> steps, + Optional name, + Optional instruction, + Optional toolId, + Map additionalProperties) { + this.messages = messages; + this.inputSchema = inputSchema; + this.outputSchema = outputSchema; + this.tool = tool; + this.steps = steps; + this.name = name; + this.instruction = instruction; + this.toolId = toolId; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the pre-configured messages that will be spoken to the user while the block is running. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the input schema for the block. This is the input the block needs to run. It's given to the block as steps[0].input + *

These are accessible as variables:

+ *
    + *
  • ({{input.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.input.propertyName}}) in context of the workflow
  • + *
+ */ + @JsonProperty("inputSchema") + public Optional getInputSchema() { + return inputSchema; + } + + /** + * @return This is the output schema for the block. This is the output the block will return to the workflow ({{stepName.output}}). + *

These are accessible as variables:

+ *
    + *
  • ({{output.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
  • + *
  • ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2)
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ */ + @JsonProperty("outputSchema") + public Optional getOutputSchema() { + return outputSchema; + } + + /** + * @return This is the tool that the block will call. To use an existing tool, use toolId. + */ + @JsonProperty("tool") + public Optional getTool() { + return tool; + } + + /** + * @return These are the steps in the workflow. + */ + @JsonProperty("steps") + public Optional> getSteps() { + return steps; + } + + /** + * @return This is the name of the block. This is just for your reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the instruction to the model. + *

You can reference any variable in the context of the current block execution (step):

+ *
    + *
  • "{{input.your-property-name}}" for the current step's input
  • + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • + *
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

This can be as simple or as complex as you want it to be.

+ *
    + *
  • "say hello and ask the user about their day!"
  • + *
  • "collect the user's first and last name"
  • + *
  • "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}. ask them about their salary and if they might be interested in buying a house. we offer {{input.offer}}"
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output/input.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output/input.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ */ + @JsonProperty("instruction") + public Optional getInstruction() { + return instruction; + } + + /** + * @return This is the id of the tool that the block will call. To use a transient tool, use tool. + */ + @JsonProperty("toolId") + public Optional getToolId() { + return toolId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateBlockDto && equalTo((UpdateBlockDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateBlockDto other) { + return messages.equals(other.messages) + && inputSchema.equals(other.inputSchema) + && outputSchema.equals(other.outputSchema) + && tool.equals(other.tool) + && steps.equals(other.steps) + && name.equals(other.name) + && instruction.equals(other.instruction) + && toolId.equals(other.toolId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.messages, + this.inputSchema, + this.outputSchema, + this.tool, + this.steps, + this.name, + this.instruction, + this.toolId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> messages = Optional.empty(); + + private Optional inputSchema = Optional.empty(); + + private Optional outputSchema = Optional.empty(); + + private Optional tool = Optional.empty(); + + private Optional> steps = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional instruction = Optional.empty(); + + private Optional toolId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateBlockDto other) { + messages(other.getMessages()); + inputSchema(other.getInputSchema()); + outputSchema(other.getOutputSchema()); + tool(other.getTool()); + steps(other.getSteps()); + name(other.getName()); + instruction(other.getInstruction()); + toolId(other.getToolId()); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "inputSchema", nulls = Nulls.SKIP) + public Builder inputSchema(Optional inputSchema) { + this.inputSchema = inputSchema; + return this; + } + + public Builder inputSchema(JsonSchema inputSchema) { + this.inputSchema = Optional.ofNullable(inputSchema); + return this; + } + + @JsonSetter(value = "outputSchema", nulls = Nulls.SKIP) + public Builder outputSchema(Optional outputSchema) { + this.outputSchema = outputSchema; + return this; + } + + public Builder outputSchema(JsonSchema outputSchema) { + this.outputSchema = Optional.ofNullable(outputSchema); + return this; + } + + @JsonSetter(value = "tool", nulls = Nulls.SKIP) + public Builder tool(Optional tool) { + this.tool = tool; + return this; + } + + public Builder tool(UpdateBlockDtoTool tool) { + this.tool = Optional.ofNullable(tool); + return this; + } + + @JsonSetter(value = "steps", nulls = Nulls.SKIP) + public Builder steps(Optional> steps) { + this.steps = steps; + return this; + } + + public Builder steps(List steps) { + this.steps = Optional.ofNullable(steps); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "instruction", nulls = Nulls.SKIP) + public Builder instruction(Optional instruction) { + this.instruction = instruction; + return this; + } + + public Builder instruction(String instruction) { + this.instruction = Optional.ofNullable(instruction); + return this; + } + + @JsonSetter(value = "toolId", nulls = Nulls.SKIP) + public Builder toolId(Optional toolId) { + this.toolId = toolId; + return this; + } + + public Builder toolId(String toolId) { + this.toolId = Optional.ofNullable(toolId); + return this; + } + + public UpdateBlockDto build() { + return new UpdateBlockDto( + messages, inputSchema, outputSchema, tool, steps, name, instruction, toolId, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/blocks/types/BlocksCreateRequest.java b/src/main/java/com/vapi/api/resources/blocks/types/BlocksCreateRequest.java new file mode 100644 index 0000000..013350d --- /dev/null +++ b/src/main/java/com/vapi/api/resources/blocks/types/BlocksCreateRequest.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.blocks.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.CreateConversationBlockDto; +import com.vapi.api.types.CreateToolCallBlockDto; +import com.vapi.api.types.CreateWorkflowBlockDto; +import java.util.Objects; +import java.util.Optional; + +public final class BlocksCreateRequest { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private BlocksCreateRequest(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static BlocksCreateRequest conversation(CreateConversationBlockDto value) { + return new BlocksCreateRequest(new ConversationValue(value)); + } + + public static BlocksCreateRequest toolCall(CreateToolCallBlockDto value) { + return new BlocksCreateRequest(new ToolCallValue(value)); + } + + public static BlocksCreateRequest workflow(CreateWorkflowBlockDto value) { + return new BlocksCreateRequest(new WorkflowValue(value)); + } + + public boolean isConversation() { + return value instanceof ConversationValue; + } + + public boolean isToolCall() { + return value instanceof ToolCallValue; + } + + public boolean isWorkflow() { + return value instanceof WorkflowValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getConversation() { + if (isConversation()) { + return Optional.of(((ConversationValue) value).value); + } + return Optional.empty(); + } + + public Optional getToolCall() { + if (isToolCall()) { + return Optional.of(((ToolCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getWorkflow() { + if (isWorkflow()) { + return Optional.of(((WorkflowValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitConversation(CreateConversationBlockDto conversation); + + T visitToolCall(CreateToolCallBlockDto toolCall); + + T visitWorkflow(CreateWorkflowBlockDto workflow); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ConversationValue.class), + @JsonSubTypes.Type(ToolCallValue.class), + @JsonSubTypes.Type(WorkflowValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("conversation") + private static final class ConversationValue implements Value { + @JsonUnwrapped + private CreateConversationBlockDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ConversationValue() {} + + private ConversationValue(CreateConversationBlockDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitConversation(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConversationValue && equalTo((ConversationValue) other); + } + + private boolean equalTo(ConversationValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksCreateRequest{" + "value: " + value + "}"; + } + } + + @JsonTypeName("tool-call") + private static final class ToolCallValue implements Value { + @JsonUnwrapped + private CreateToolCallBlockDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ToolCallValue() {} + + private ToolCallValue(CreateToolCallBlockDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitToolCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallValue && equalTo((ToolCallValue) other); + } + + private boolean equalTo(ToolCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksCreateRequest{" + "value: " + value + "}"; + } + } + + @JsonTypeName("workflow") + private static final class WorkflowValue implements Value { + @JsonUnwrapped + private CreateWorkflowBlockDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private WorkflowValue() {} + + private WorkflowValue(CreateWorkflowBlockDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitWorkflow(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkflowValue && equalTo((WorkflowValue) other); + } + + private boolean equalTo(WorkflowValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksCreateRequest{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksCreateRequest{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/blocks/types/BlocksCreateResponse.java b/src/main/java/com/vapi/api/resources/blocks/types/BlocksCreateResponse.java new file mode 100644 index 0000000..b367ee0 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/blocks/types/BlocksCreateResponse.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.blocks.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.ConversationBlock; +import com.vapi.api.types.ToolCallBlock; +import com.vapi.api.types.WorkflowBlock; +import java.util.Objects; +import java.util.Optional; + +public final class BlocksCreateResponse { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private BlocksCreateResponse(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static BlocksCreateResponse conversation(ConversationBlock value) { + return new BlocksCreateResponse(new ConversationValue(value)); + } + + public static BlocksCreateResponse toolCall(ToolCallBlock value) { + return new BlocksCreateResponse(new ToolCallValue(value)); + } + + public static BlocksCreateResponse workflow(WorkflowBlock value) { + return new BlocksCreateResponse(new WorkflowValue(value)); + } + + public boolean isConversation() { + return value instanceof ConversationValue; + } + + public boolean isToolCall() { + return value instanceof ToolCallValue; + } + + public boolean isWorkflow() { + return value instanceof WorkflowValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getConversation() { + if (isConversation()) { + return Optional.of(((ConversationValue) value).value); + } + return Optional.empty(); + } + + public Optional getToolCall() { + if (isToolCall()) { + return Optional.of(((ToolCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getWorkflow() { + if (isWorkflow()) { + return Optional.of(((WorkflowValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitConversation(ConversationBlock conversation); + + T visitToolCall(ToolCallBlock toolCall); + + T visitWorkflow(WorkflowBlock workflow); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ConversationValue.class), + @JsonSubTypes.Type(ToolCallValue.class), + @JsonSubTypes.Type(WorkflowValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("conversation") + private static final class ConversationValue implements Value { + @JsonUnwrapped + private ConversationBlock value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ConversationValue() {} + + private ConversationValue(ConversationBlock value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitConversation(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConversationValue && equalTo((ConversationValue) other); + } + + private boolean equalTo(ConversationValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksCreateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("tool-call") + private static final class ToolCallValue implements Value { + @JsonUnwrapped + private ToolCallBlock value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ToolCallValue() {} + + private ToolCallValue(ToolCallBlock value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitToolCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallValue && equalTo((ToolCallValue) other); + } + + private boolean equalTo(ToolCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksCreateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("workflow") + private static final class WorkflowValue implements Value { + @JsonUnwrapped + private WorkflowBlock value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private WorkflowValue() {} + + private WorkflowValue(WorkflowBlock value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitWorkflow(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkflowValue && equalTo((WorkflowValue) other); + } + + private boolean equalTo(WorkflowValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksCreateResponse{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksCreateResponse{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/blocks/types/BlocksDeleteResponse.java b/src/main/java/com/vapi/api/resources/blocks/types/BlocksDeleteResponse.java new file mode 100644 index 0000000..2367a49 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/blocks/types/BlocksDeleteResponse.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.blocks.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.ConversationBlock; +import com.vapi.api.types.ToolCallBlock; +import com.vapi.api.types.WorkflowBlock; +import java.util.Objects; +import java.util.Optional; + +public final class BlocksDeleteResponse { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private BlocksDeleteResponse(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static BlocksDeleteResponse conversation(ConversationBlock value) { + return new BlocksDeleteResponse(new ConversationValue(value)); + } + + public static BlocksDeleteResponse toolCall(ToolCallBlock value) { + return new BlocksDeleteResponse(new ToolCallValue(value)); + } + + public static BlocksDeleteResponse workflow(WorkflowBlock value) { + return new BlocksDeleteResponse(new WorkflowValue(value)); + } + + public boolean isConversation() { + return value instanceof ConversationValue; + } + + public boolean isToolCall() { + return value instanceof ToolCallValue; + } + + public boolean isWorkflow() { + return value instanceof WorkflowValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getConversation() { + if (isConversation()) { + return Optional.of(((ConversationValue) value).value); + } + return Optional.empty(); + } + + public Optional getToolCall() { + if (isToolCall()) { + return Optional.of(((ToolCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getWorkflow() { + if (isWorkflow()) { + return Optional.of(((WorkflowValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitConversation(ConversationBlock conversation); + + T visitToolCall(ToolCallBlock toolCall); + + T visitWorkflow(WorkflowBlock workflow); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ConversationValue.class), + @JsonSubTypes.Type(ToolCallValue.class), + @JsonSubTypes.Type(WorkflowValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("conversation") + private static final class ConversationValue implements Value { + @JsonUnwrapped + private ConversationBlock value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ConversationValue() {} + + private ConversationValue(ConversationBlock value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitConversation(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConversationValue && equalTo((ConversationValue) other); + } + + private boolean equalTo(ConversationValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksDeleteResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("tool-call") + private static final class ToolCallValue implements Value { + @JsonUnwrapped + private ToolCallBlock value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ToolCallValue() {} + + private ToolCallValue(ToolCallBlock value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitToolCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallValue && equalTo((ToolCallValue) other); + } + + private boolean equalTo(ToolCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksDeleteResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("workflow") + private static final class WorkflowValue implements Value { + @JsonUnwrapped + private WorkflowBlock value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private WorkflowValue() {} + + private WorkflowValue(WorkflowBlock value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitWorkflow(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkflowValue && equalTo((WorkflowValue) other); + } + + private boolean equalTo(WorkflowValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksDeleteResponse{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksDeleteResponse{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/blocks/types/BlocksGetResponse.java b/src/main/java/com/vapi/api/resources/blocks/types/BlocksGetResponse.java new file mode 100644 index 0000000..1ff4fd9 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/blocks/types/BlocksGetResponse.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.blocks.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.ConversationBlock; +import com.vapi.api.types.ToolCallBlock; +import com.vapi.api.types.WorkflowBlock; +import java.util.Objects; +import java.util.Optional; + +public final class BlocksGetResponse { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private BlocksGetResponse(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static BlocksGetResponse conversation(ConversationBlock value) { + return new BlocksGetResponse(new ConversationValue(value)); + } + + public static BlocksGetResponse toolCall(ToolCallBlock value) { + return new BlocksGetResponse(new ToolCallValue(value)); + } + + public static BlocksGetResponse workflow(WorkflowBlock value) { + return new BlocksGetResponse(new WorkflowValue(value)); + } + + public boolean isConversation() { + return value instanceof ConversationValue; + } + + public boolean isToolCall() { + return value instanceof ToolCallValue; + } + + public boolean isWorkflow() { + return value instanceof WorkflowValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getConversation() { + if (isConversation()) { + return Optional.of(((ConversationValue) value).value); + } + return Optional.empty(); + } + + public Optional getToolCall() { + if (isToolCall()) { + return Optional.of(((ToolCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getWorkflow() { + if (isWorkflow()) { + return Optional.of(((WorkflowValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitConversation(ConversationBlock conversation); + + T visitToolCall(ToolCallBlock toolCall); + + T visitWorkflow(WorkflowBlock workflow); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ConversationValue.class), + @JsonSubTypes.Type(ToolCallValue.class), + @JsonSubTypes.Type(WorkflowValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("conversation") + private static final class ConversationValue implements Value { + @JsonUnwrapped + private ConversationBlock value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ConversationValue() {} + + private ConversationValue(ConversationBlock value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitConversation(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConversationValue && equalTo((ConversationValue) other); + } + + private boolean equalTo(ConversationValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksGetResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("tool-call") + private static final class ToolCallValue implements Value { + @JsonUnwrapped + private ToolCallBlock value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ToolCallValue() {} + + private ToolCallValue(ToolCallBlock value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitToolCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallValue && equalTo((ToolCallValue) other); + } + + private boolean equalTo(ToolCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksGetResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("workflow") + private static final class WorkflowValue implements Value { + @JsonUnwrapped + private WorkflowBlock value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private WorkflowValue() {} + + private WorkflowValue(WorkflowBlock value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitWorkflow(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkflowValue && equalTo((WorkflowValue) other); + } + + private boolean equalTo(WorkflowValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksGetResponse{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksGetResponse{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/blocks/types/BlocksListResponseItem.java b/src/main/java/com/vapi/api/resources/blocks/types/BlocksListResponseItem.java new file mode 100644 index 0000000..e450d53 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/blocks/types/BlocksListResponseItem.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.blocks.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.ConversationBlock; +import com.vapi.api.types.ToolCallBlock; +import com.vapi.api.types.WorkflowBlock; +import java.util.Objects; +import java.util.Optional; + +public final class BlocksListResponseItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private BlocksListResponseItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static BlocksListResponseItem conversation(ConversationBlock value) { + return new BlocksListResponseItem(new ConversationValue(value)); + } + + public static BlocksListResponseItem toolCall(ToolCallBlock value) { + return new BlocksListResponseItem(new ToolCallValue(value)); + } + + public static BlocksListResponseItem workflow(WorkflowBlock value) { + return new BlocksListResponseItem(new WorkflowValue(value)); + } + + public boolean isConversation() { + return value instanceof ConversationValue; + } + + public boolean isToolCall() { + return value instanceof ToolCallValue; + } + + public boolean isWorkflow() { + return value instanceof WorkflowValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getConversation() { + if (isConversation()) { + return Optional.of(((ConversationValue) value).value); + } + return Optional.empty(); + } + + public Optional getToolCall() { + if (isToolCall()) { + return Optional.of(((ToolCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getWorkflow() { + if (isWorkflow()) { + return Optional.of(((WorkflowValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitConversation(ConversationBlock conversation); + + T visitToolCall(ToolCallBlock toolCall); + + T visitWorkflow(WorkflowBlock workflow); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ConversationValue.class), + @JsonSubTypes.Type(ToolCallValue.class), + @JsonSubTypes.Type(WorkflowValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("conversation") + private static final class ConversationValue implements Value { + @JsonUnwrapped + private ConversationBlock value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ConversationValue() {} + + private ConversationValue(ConversationBlock value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitConversation(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConversationValue && equalTo((ConversationValue) other); + } + + private boolean equalTo(ConversationValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksListResponseItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("tool-call") + private static final class ToolCallValue implements Value { + @JsonUnwrapped + private ToolCallBlock value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ToolCallValue() {} + + private ToolCallValue(ToolCallBlock value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitToolCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallValue && equalTo((ToolCallValue) other); + } + + private boolean equalTo(ToolCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksListResponseItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("workflow") + private static final class WorkflowValue implements Value { + @JsonUnwrapped + private WorkflowBlock value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private WorkflowValue() {} + + private WorkflowValue(WorkflowBlock value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitWorkflow(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkflowValue && equalTo((WorkflowValue) other); + } + + private boolean equalTo(WorkflowValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksListResponseItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksListResponseItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/blocks/types/BlocksUpdateResponse.java b/src/main/java/com/vapi/api/resources/blocks/types/BlocksUpdateResponse.java new file mode 100644 index 0000000..3a3f22d --- /dev/null +++ b/src/main/java/com/vapi/api/resources/blocks/types/BlocksUpdateResponse.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.blocks.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.ConversationBlock; +import com.vapi.api.types.ToolCallBlock; +import com.vapi.api.types.WorkflowBlock; +import java.util.Objects; +import java.util.Optional; + +public final class BlocksUpdateResponse { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private BlocksUpdateResponse(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static BlocksUpdateResponse conversation(ConversationBlock value) { + return new BlocksUpdateResponse(new ConversationValue(value)); + } + + public static BlocksUpdateResponse toolCall(ToolCallBlock value) { + return new BlocksUpdateResponse(new ToolCallValue(value)); + } + + public static BlocksUpdateResponse workflow(WorkflowBlock value) { + return new BlocksUpdateResponse(new WorkflowValue(value)); + } + + public boolean isConversation() { + return value instanceof ConversationValue; + } + + public boolean isToolCall() { + return value instanceof ToolCallValue; + } + + public boolean isWorkflow() { + return value instanceof WorkflowValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getConversation() { + if (isConversation()) { + return Optional.of(((ConversationValue) value).value); + } + return Optional.empty(); + } + + public Optional getToolCall() { + if (isToolCall()) { + return Optional.of(((ToolCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getWorkflow() { + if (isWorkflow()) { + return Optional.of(((WorkflowValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitConversation(ConversationBlock conversation); + + T visitToolCall(ToolCallBlock toolCall); + + T visitWorkflow(WorkflowBlock workflow); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ConversationValue.class), + @JsonSubTypes.Type(ToolCallValue.class), + @JsonSubTypes.Type(WorkflowValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("conversation") + private static final class ConversationValue implements Value { + @JsonUnwrapped + private ConversationBlock value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ConversationValue() {} + + private ConversationValue(ConversationBlock value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitConversation(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConversationValue && equalTo((ConversationValue) other); + } + + private boolean equalTo(ConversationValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksUpdateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("tool-call") + private static final class ToolCallValue implements Value { + @JsonUnwrapped + private ToolCallBlock value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ToolCallValue() {} + + private ToolCallValue(ToolCallBlock value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitToolCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallValue && equalTo((ToolCallValue) other); + } + + private boolean equalTo(ToolCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksUpdateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("workflow") + private static final class WorkflowValue implements Value { + @JsonUnwrapped + private WorkflowBlock value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private WorkflowValue() {} + + private WorkflowValue(WorkflowBlock value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitWorkflow(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkflowValue && equalTo((WorkflowValue) other); + } + + private boolean equalTo(WorkflowValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksUpdateResponse{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "BlocksUpdateResponse{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/blocks/types/UpdateBlockDtoMessagesItem.java b/src/main/java/com/vapi/api/resources/blocks/types/UpdateBlockDtoMessagesItem.java new file mode 100644 index 0000000..a331494 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/blocks/types/UpdateBlockDtoMessagesItem.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.blocks.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.BlockCompleteMessage; +import com.vapi.api.types.BlockStartMessage; +import java.util.Objects; +import java.util.Optional; + +public final class UpdateBlockDtoMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private UpdateBlockDtoMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static UpdateBlockDtoMessagesItem blockStart(BlockStartMessage value) { + return new UpdateBlockDtoMessagesItem(new BlockStartValue(value)); + } + + public static UpdateBlockDtoMessagesItem blockComplete(BlockCompleteMessage value) { + return new UpdateBlockDtoMessagesItem(new BlockCompleteValue(value)); + } + + public boolean isBlockStart() { + return value instanceof BlockStartValue; + } + + public boolean isBlockComplete() { + return value instanceof BlockCompleteValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getBlockStart() { + if (isBlockStart()) { + return Optional.of(((BlockStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getBlockComplete() { + if (isBlockComplete()) { + return Optional.of(((BlockCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitBlockStart(BlockStartMessage blockStart); + + T visitBlockComplete(BlockCompleteMessage blockComplete); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(BlockStartValue.class), @JsonSubTypes.Type(BlockCompleteValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("block-start") + private static final class BlockStartValue implements Value { + @JsonUnwrapped + private BlockStartMessage value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BlockStartValue() {} + + private BlockStartValue(BlockStartMessage value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBlockStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockStartValue && equalTo((BlockStartValue) other); + } + + private boolean equalTo(BlockStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateBlockDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("block-complete") + private static final class BlockCompleteValue implements Value { + @JsonUnwrapped + private BlockCompleteMessage value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BlockCompleteValue() {} + + private BlockCompleteValue(BlockCompleteMessage value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBlockComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockCompleteValue && equalTo((BlockCompleteValue) other); + } + + private boolean equalTo(BlockCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateBlockDtoMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateBlockDtoMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/blocks/types/UpdateBlockDtoStepsItem.java b/src/main/java/com/vapi/api/resources/blocks/types/UpdateBlockDtoStepsItem.java new file mode 100644 index 0000000..fd2ec81 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/blocks/types/UpdateBlockDtoStepsItem.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.blocks.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.CallbackStep; +import com.vapi.api.types.HandoffStep; +import java.util.Objects; +import java.util.Optional; + +public final class UpdateBlockDtoStepsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private UpdateBlockDtoStepsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static UpdateBlockDtoStepsItem handoff(HandoffStep value) { + return new UpdateBlockDtoStepsItem(new HandoffValue(value)); + } + + public static UpdateBlockDtoStepsItem callback(CallbackStep value) { + return new UpdateBlockDtoStepsItem(new CallbackValue(value)); + } + + public boolean isHandoff() { + return value instanceof HandoffValue; + } + + public boolean isCallback() { + return value instanceof CallbackValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getHandoff() { + if (isHandoff()) { + return Optional.of(((HandoffValue) value).value); + } + return Optional.empty(); + } + + public Optional getCallback() { + if (isCallback()) { + return Optional.of(((CallbackValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitHandoff(HandoffStep handoff); + + T visitCallback(CallbackStep callback); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(HandoffValue.class), @JsonSubTypes.Type(CallbackValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("handoff") + private static final class HandoffValue implements Value { + @JsonUnwrapped + private HandoffStep value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private HandoffValue() {} + + private HandoffValue(HandoffStep value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitHandoff(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof HandoffValue && equalTo((HandoffValue) other); + } + + private boolean equalTo(HandoffValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateBlockDtoStepsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("callback") + private static final class CallbackValue implements Value { + @JsonUnwrapped + private CallbackStep value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CallbackValue() {} + + private CallbackValue(CallbackStep value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCallback(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CallbackValue && equalTo((CallbackValue) other); + } + + private boolean equalTo(CallbackValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateBlockDtoStepsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateBlockDtoStepsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/blocks/types/UpdateBlockDtoTool.java b/src/main/java/com/vapi/api/resources/blocks/types/UpdateBlockDtoTool.java new file mode 100644 index 0000000..cc3454b --- /dev/null +++ b/src/main/java/com/vapi/api/resources/blocks/types/UpdateBlockDtoTool.java @@ -0,0 +1,490 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.blocks.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.CreateDtmfToolDto; +import com.vapi.api.types.CreateEndCallToolDto; +import com.vapi.api.types.CreateFunctionToolDto; +import com.vapi.api.types.CreateGhlToolDto; +import com.vapi.api.types.CreateMakeToolDto; +import com.vapi.api.types.CreateTransferCallToolDto; +import com.vapi.api.types.CreateVoicemailToolDto; +import java.util.Objects; +import java.util.Optional; + +public final class UpdateBlockDtoTool { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private UpdateBlockDtoTool(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static UpdateBlockDtoTool dtmf(CreateDtmfToolDto value) { + return new UpdateBlockDtoTool(new DtmfValue(value)); + } + + public static UpdateBlockDtoTool endCall(CreateEndCallToolDto value) { + return new UpdateBlockDtoTool(new EndCallValue(value)); + } + + public static UpdateBlockDtoTool voicemail(CreateVoicemailToolDto value) { + return new UpdateBlockDtoTool(new VoicemailValue(value)); + } + + public static UpdateBlockDtoTool function(CreateFunctionToolDto value) { + return new UpdateBlockDtoTool(new FunctionValue(value)); + } + + public static UpdateBlockDtoTool ghl(CreateGhlToolDto value) { + return new UpdateBlockDtoTool(new GhlValue(value)); + } + + public static UpdateBlockDtoTool make(CreateMakeToolDto value) { + return new UpdateBlockDtoTool(new MakeValue(value)); + } + + public static UpdateBlockDtoTool transferCall(CreateTransferCallToolDto value) { + return new UpdateBlockDtoTool(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateBlockDtoTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateBlockDtoTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateBlockDtoTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateBlockDtoTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateBlockDtoTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateBlockDtoTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateBlockDtoTool{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateBlockDtoTool{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/calls/CallsClient.java b/src/main/java/com/vapi/api/resources/calls/CallsClient.java new file mode 100644 index 0000000..78983b0 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/calls/CallsClient.java @@ -0,0 +1,270 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.calls; + +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.calls.requests.CallsListRequest; +import com.vapi.api.resources.calls.requests.CreateCallDto; +import com.vapi.api.resources.calls.requests.UpdateCallDto; +import com.vapi.api.types.Call; +import java.io.IOException; +import java.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class CallsClient { + protected final ClientOptions clientOptions; + + public CallsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public List list() { + return list(CallsListRequest.builder().build()); + } + + public List list(CallsListRequest request) { + return list(request, null); + } + + public List list(CallsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("call"); + if (request.getAssistantId().isPresent()) { + httpUrl.addQueryParameter("assistantId", request.getAssistantId().get()); + } + if (request.getLimit().isPresent()) { + httpUrl.addQueryParameter("limit", request.getLimit().get().toString()); + } + if (request.getCreatedAtGt().isPresent()) { + httpUrl.addQueryParameter( + "createdAtGt", request.getCreatedAtGt().get().toString()); + } + if (request.getCreatedAtLt().isPresent()) { + httpUrl.addQueryParameter( + "createdAtLt", request.getCreatedAtLt().get().toString()); + } + if (request.getCreatedAtGe().isPresent()) { + httpUrl.addQueryParameter( + "createdAtGe", request.getCreatedAtGe().get().toString()); + } + if (request.getCreatedAtLe().isPresent()) { + httpUrl.addQueryParameter( + "createdAtLe", request.getCreatedAtLe().get().toString()); + } + if (request.getUpdatedAtGt().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtGt", request.getUpdatedAtGt().get().toString()); + } + if (request.getUpdatedAtLt().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtLt", request.getUpdatedAtLt().get().toString()); + } + if (request.getUpdatedAtGe().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtGe", request.getUpdatedAtGe().get().toString()); + } + if (request.getUpdatedAtLe().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtLe", request.getUpdatedAtLe().get().toString()); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), new TypeReference>() {}); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public Call create() { + return create(CreateCallDto.builder().build()); + } + + public Call create(CreateCallDto request) { + return create(request, null); + } + + public Call create(CreateCallDto request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("call") + .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) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Call.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public Call get(String id) { + return get(id, null); + } + + public Call get(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("call") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Call.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public Call delete(String id) { + return delete(id, null); + } + + public Call delete(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("call") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Call.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public Call update(String id) { + return update(id, UpdateCallDto.builder().build()); + } + + public Call update(String id, UpdateCallDto request) { + return update(id, request, null); + } + + public Call update(String id, UpdateCallDto request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("call") + .addPathSegment(id) + .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("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Call.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/calls/requests/CallsListRequest.java b/src/main/java/com/vapi/api/resources/calls/requests/CallsListRequest.java new file mode 100644 index 0000000..0f74f2b --- /dev/null +++ b/src/main/java/com/vapi/api/resources/calls/requests/CallsListRequest.java @@ -0,0 +1,365 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.calls.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CallsListRequest.Builder.class) +public final class CallsListRequest { + private final Optional assistantId; + + private final Optional limit; + + private final Optional createdAtGt; + + private final Optional createdAtLt; + + private final Optional createdAtGe; + + private final Optional createdAtLe; + + private final Optional updatedAtGt; + + private final Optional updatedAtLt; + + private final Optional updatedAtGe; + + private final Optional updatedAtLe; + + private final Map additionalProperties; + + private CallsListRequest( + Optional assistantId, + Optional limit, + Optional createdAtGt, + Optional createdAtLt, + Optional createdAtGe, + Optional createdAtLe, + Optional updatedAtGt, + Optional updatedAtLt, + Optional updatedAtGe, + Optional updatedAtLe, + Map additionalProperties) { + this.assistantId = assistantId; + this.limit = limit; + this.createdAtGt = createdAtGt; + this.createdAtLt = createdAtLt; + this.createdAtGe = createdAtGe; + this.createdAtLe = createdAtLe; + this.updatedAtGt = updatedAtGt; + this.updatedAtLt = updatedAtLt; + this.updatedAtGe = updatedAtGe; + this.updatedAtLe = updatedAtLe; + this.additionalProperties = additionalProperties; + } + + /** + * @return This will return calls with the specified assistantId. + */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the maximum number of items to return. Defaults to 100. + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return This will return items where the createdAt is greater than the specified value. + */ + @JsonProperty("createdAtGt") + public Optional getCreatedAtGt() { + return createdAtGt; + } + + /** + * @return This will return items where the createdAt is less than the specified value. + */ + @JsonProperty("createdAtLt") + public Optional getCreatedAtLt() { + return createdAtLt; + } + + /** + * @return This will return items where the createdAt is greater than or equal to the specified value. + */ + @JsonProperty("createdAtGe") + public Optional getCreatedAtGe() { + return createdAtGe; + } + + /** + * @return This will return items where the createdAt is less than or equal to the specified value. + */ + @JsonProperty("createdAtLe") + public Optional getCreatedAtLe() { + return createdAtLe; + } + + /** + * @return This will return items where the updatedAt is greater than the specified value. + */ + @JsonProperty("updatedAtGt") + public Optional getUpdatedAtGt() { + return updatedAtGt; + } + + /** + * @return This will return items where the updatedAt is less than the specified value. + */ + @JsonProperty("updatedAtLt") + public Optional getUpdatedAtLt() { + return updatedAtLt; + } + + /** + * @return This will return items where the updatedAt is greater than or equal to the specified value. + */ + @JsonProperty("updatedAtGe") + public Optional getUpdatedAtGe() { + return updatedAtGe; + } + + /** + * @return This will return items where the updatedAt is less than or equal to the specified value. + */ + @JsonProperty("updatedAtLe") + public Optional getUpdatedAtLe() { + return updatedAtLe; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CallsListRequest && equalTo((CallsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CallsListRequest other) { + return assistantId.equals(other.assistantId) + && limit.equals(other.limit) + && createdAtGt.equals(other.createdAtGt) + && createdAtLt.equals(other.createdAtLt) + && createdAtGe.equals(other.createdAtGe) + && createdAtLe.equals(other.createdAtLe) + && updatedAtGt.equals(other.updatedAtGt) + && updatedAtLt.equals(other.updatedAtLt) + && updatedAtGe.equals(other.updatedAtGe) + && updatedAtLe.equals(other.updatedAtLe); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.assistantId, + this.limit, + this.createdAtGt, + this.createdAtLt, + this.createdAtGe, + this.createdAtLe, + this.updatedAtGt, + this.updatedAtLt, + this.updatedAtGe, + this.updatedAtLe); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional assistantId = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional createdAtGt = Optional.empty(); + + private Optional createdAtLt = Optional.empty(); + + private Optional createdAtGe = Optional.empty(); + + private Optional createdAtLe = Optional.empty(); + + private Optional updatedAtGt = Optional.empty(); + + private Optional updatedAtLt = Optional.empty(); + + private Optional updatedAtGe = Optional.empty(); + + private Optional updatedAtLe = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CallsListRequest other) { + assistantId(other.getAssistantId()); + limit(other.getLimit()); + createdAtGt(other.getCreatedAtGt()); + createdAtLt(other.getCreatedAtLt()); + createdAtGe(other.getCreatedAtGe()); + createdAtLe(other.getCreatedAtLe()); + updatedAtGt(other.getUpdatedAtGt()); + updatedAtLt(other.getUpdatedAtLt()); + updatedAtGe(other.getUpdatedAtGe()); + updatedAtLe(other.getUpdatedAtLe()); + return this; + } + + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public Builder assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + public Builder assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Double limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + @JsonSetter(value = "createdAtGt", nulls = Nulls.SKIP) + public Builder createdAtGt(Optional createdAtGt) { + this.createdAtGt = createdAtGt; + return this; + } + + public Builder createdAtGt(OffsetDateTime createdAtGt) { + this.createdAtGt = Optional.ofNullable(createdAtGt); + return this; + } + + @JsonSetter(value = "createdAtLt", nulls = Nulls.SKIP) + public Builder createdAtLt(Optional createdAtLt) { + this.createdAtLt = createdAtLt; + return this; + } + + public Builder createdAtLt(OffsetDateTime createdAtLt) { + this.createdAtLt = Optional.ofNullable(createdAtLt); + return this; + } + + @JsonSetter(value = "createdAtGe", nulls = Nulls.SKIP) + public Builder createdAtGe(Optional createdAtGe) { + this.createdAtGe = createdAtGe; + return this; + } + + public Builder createdAtGe(OffsetDateTime createdAtGe) { + this.createdAtGe = Optional.ofNullable(createdAtGe); + return this; + } + + @JsonSetter(value = "createdAtLe", nulls = Nulls.SKIP) + public Builder createdAtLe(Optional createdAtLe) { + this.createdAtLe = createdAtLe; + return this; + } + + public Builder createdAtLe(OffsetDateTime createdAtLe) { + this.createdAtLe = Optional.ofNullable(createdAtLe); + return this; + } + + @JsonSetter(value = "updatedAtGt", nulls = Nulls.SKIP) + public Builder updatedAtGt(Optional updatedAtGt) { + this.updatedAtGt = updatedAtGt; + return this; + } + + public Builder updatedAtGt(OffsetDateTime updatedAtGt) { + this.updatedAtGt = Optional.ofNullable(updatedAtGt); + return this; + } + + @JsonSetter(value = "updatedAtLt", nulls = Nulls.SKIP) + public Builder updatedAtLt(Optional updatedAtLt) { + this.updatedAtLt = updatedAtLt; + return this; + } + + public Builder updatedAtLt(OffsetDateTime updatedAtLt) { + this.updatedAtLt = Optional.ofNullable(updatedAtLt); + return this; + } + + @JsonSetter(value = "updatedAtGe", nulls = Nulls.SKIP) + public Builder updatedAtGe(Optional updatedAtGe) { + this.updatedAtGe = updatedAtGe; + return this; + } + + public Builder updatedAtGe(OffsetDateTime updatedAtGe) { + this.updatedAtGe = Optional.ofNullable(updatedAtGe); + return this; + } + + @JsonSetter(value = "updatedAtLe", nulls = Nulls.SKIP) + public Builder updatedAtLe(Optional updatedAtLe) { + this.updatedAtLe = updatedAtLe; + return this; + } + + public Builder updatedAtLe(OffsetDateTime updatedAtLe) { + this.updatedAtLe = Optional.ofNullable(updatedAtLe); + return this; + } + + public CallsListRequest build() { + return new CallsListRequest( + assistantId, + limit, + createdAtGt, + createdAtLt, + createdAtGe, + createdAtLe, + updatedAtGt, + updatedAtLt, + updatedAtGe, + updatedAtLe, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/calls/requests/CreateCallDto.java b/src/main/java/com/vapi/api/resources/calls/requests/CreateCallDto.java new file mode 100644 index 0000000..a9792be --- /dev/null +++ b/src/main/java/com/vapi/api/resources/calls/requests/CreateCallDto.java @@ -0,0 +1,373 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.calls.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import com.vapi.api.types.AssistantOverrides; +import com.vapi.api.types.CreateAssistantDto; +import com.vapi.api.types.CreateCustomerDto; +import com.vapi.api.types.CreateSquadDto; +import com.vapi.api.types.ImportTwilioPhoneNumberDto; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCallDto.Builder.class) +public final class CreateCallDto { + private final Optional name; + + private final Optional assistantId; + + private final Optional assistant; + + private final Optional assistantOverrides; + + private final Optional squadId; + + private final Optional squad; + + private final Optional phoneNumberId; + + private final Optional phoneNumber; + + private final Optional customerId; + + private final Optional customer; + + private final Map additionalProperties; + + private CreateCallDto( + Optional name, + Optional assistantId, + Optional assistant, + Optional assistantOverrides, + Optional squadId, + Optional squad, + Optional phoneNumberId, + Optional phoneNumber, + Optional customerId, + Optional customer, + Map additionalProperties) { + this.name = name; + this.assistantId = assistantId; + this.assistant = assistant; + this.assistantOverrides = assistantOverrides; + this.squadId = squadId; + this.squad = squad; + this.phoneNumberId = phoneNumberId; + this.phoneNumber = phoneNumber; + this.customerId = customerId; + this.customer = customer; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the name of the call. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the assistant that will be used for the call. To use a transient assistant, use assistant instead. + */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the assistant that will be used for the call. To use an existing assistant, use assistantId instead. + */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return These are the overrides for the assistant or assistantId's settings and template variables. + */ + @JsonProperty("assistantOverrides") + public Optional getAssistantOverrides() { + return assistantOverrides; + } + + /** + * @return This is the squad that will be used for the call. To use a transient squad, use squad instead. + */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is a squad that will be used for the call. To use an existing squad, use squadId instead. + */ + @JsonProperty("squad") + public Optional getSquad() { + return squad; + } + + /** + * @return This is the phone number that will be used for the call. To use a transient number, use phoneNumber instead. + *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ */ + @JsonProperty("phoneNumberId") + public Optional getPhoneNumberId() { + return phoneNumberId; + } + + /** + * @return This is the phone number that will be used for the call. To use an existing number, use phoneNumberId instead. + *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the customer that will be called. To call a transient customer , use customer instead. + *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ */ + @JsonProperty("customerId") + public Optional getCustomerId() { + return customerId; + } + + /** + * @return This is the customer that will be called. To call an existing customer, use customerId instead. + *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCallDto && equalTo((CreateCallDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCallDto other) { + return name.equals(other.name) + && assistantId.equals(other.assistantId) + && assistant.equals(other.assistant) + && assistantOverrides.equals(other.assistantOverrides) + && squadId.equals(other.squadId) + && squad.equals(other.squad) + && phoneNumberId.equals(other.phoneNumberId) + && phoneNumber.equals(other.phoneNumber) + && customerId.equals(other.customerId) + && customer.equals(other.customer); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.name, + this.assistantId, + this.assistant, + this.assistantOverrides, + this.squadId, + this.squad, + this.phoneNumberId, + this.phoneNumber, + this.customerId, + this.customer); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional assistantOverrides = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional squad = Optional.empty(); + + private Optional phoneNumberId = Optional.empty(); + + private Optional phoneNumber = Optional.empty(); + + private Optional customerId = Optional.empty(); + + private Optional customer = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateCallDto other) { + name(other.getName()); + assistantId(other.getAssistantId()); + assistant(other.getAssistant()); + assistantOverrides(other.getAssistantOverrides()); + squadId(other.getSquadId()); + squad(other.getSquad()); + phoneNumberId(other.getPhoneNumberId()); + phoneNumber(other.getPhoneNumber()); + customerId(other.getCustomerId()); + customer(other.getCustomer()); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public Builder assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + public Builder assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public Builder assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + public Builder assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @JsonSetter(value = "assistantOverrides", nulls = Nulls.SKIP) + public Builder assistantOverrides(Optional assistantOverrides) { + this.assistantOverrides = assistantOverrides; + return this; + } + + public Builder assistantOverrides(AssistantOverrides assistantOverrides) { + this.assistantOverrides = Optional.ofNullable(assistantOverrides); + return this; + } + + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public Builder squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + public Builder squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @JsonSetter(value = "squad", nulls = Nulls.SKIP) + public Builder squad(Optional squad) { + this.squad = squad; + return this; + } + + public Builder squad(CreateSquadDto squad) { + this.squad = Optional.ofNullable(squad); + return this; + } + + @JsonSetter(value = "phoneNumberId", nulls = Nulls.SKIP) + public Builder phoneNumberId(Optional phoneNumberId) { + this.phoneNumberId = phoneNumberId; + return this; + } + + public Builder phoneNumberId(String phoneNumberId) { + this.phoneNumberId = Optional.ofNullable(phoneNumberId); + return this; + } + + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public Builder phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + public Builder phoneNumber(ImportTwilioPhoneNumberDto phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @JsonSetter(value = "customerId", nulls = Nulls.SKIP) + public Builder customerId(Optional customerId) { + this.customerId = customerId; + return this; + } + + public Builder customerId(String customerId) { + this.customerId = Optional.ofNullable(customerId); + return this; + } + + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public Builder customer(Optional customer) { + this.customer = customer; + return this; + } + + public Builder customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + public CreateCallDto build() { + return new CreateCallDto( + name, + assistantId, + assistant, + assistantOverrides, + squadId, + squad, + phoneNumberId, + phoneNumber, + customerId, + customer, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/calls/requests/UpdateCallDto.java b/src/main/java/com/vapi/api/resources/calls/requests/UpdateCallDto.java new file mode 100644 index 0000000..6e27358 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/calls/requests/UpdateCallDto.java @@ -0,0 +1,98 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.calls.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCallDto.Builder.class) +public final class UpdateCallDto { + private final Optional name; + + private final Map additionalProperties; + + private UpdateCallDto(Optional name, Map additionalProperties) { + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the name of the call. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCallDto && equalTo((UpdateCallDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCallDto other) { + return name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateCallDto other) { + name(other.getName()); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public UpdateCallDto build() { + return new UpdateCallDto(name, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/files/FilesClient.java b/src/main/java/com/vapi/api/resources/files/FilesClient.java new file mode 100644 index 0000000..241d384 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/files/FilesClient.java @@ -0,0 +1,235 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.files; + +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.errors.BadRequestError; +import com.vapi.api.resources.files.requests.CreateFileDto; +import com.vapi.api.resources.files.requests.UpdateFileDto; +import com.vapi.api.types.File; +import java.io.IOException; +import java.nio.file.Files; +import java.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.MediaType; +import okhttp3.MultipartBody; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class FilesClient { + protected final ClientOptions clientOptions; + + public FilesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public List list() { + return list(null); + } + + public List list(RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("file") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), new TypeReference>() {}); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public File create(java.io.File file, CreateFileDto request) { + return create(file, request, null); + } + + public File create(java.io.File file, CreateFileDto request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("file") + .build(); + MultipartBody.Builder body = new MultipartBody.Builder().setType(MultipartBody.FORM); + try { + String fileMimeType = Files.probeContentType(file.toPath()); + MediaType fileMimeTypeMediaType = fileMimeType != null ? MediaType.parse(fileMimeType) : null; + body.addFormDataPart("file", file.getName(), RequestBody.create(fileMimeTypeMediaType, file)); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body.build()) + .headers(Headers.of(clientOptions.headers(requestOptions))); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), File.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + try { + if (response.code() == 400) { + throw new BadRequestError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } + } catch (JsonProcessingException ignored) { + // unable to map error response, throwing generic error + } + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public File get(String id) { + return get(id, null); + } + + public File get(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("file") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), File.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public File delete(String id) { + return delete(id, null); + } + + public File delete(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("file") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), File.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public File update(String id) { + return update(id, UpdateFileDto.builder().build()); + } + + public File update(String id, UpdateFileDto request) { + return update(id, request, null); + } + + public File update(String id, UpdateFileDto request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("file") + .addPathSegment(id) + .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("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), File.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/files/requests/CreateFileDto.java b/src/main/java/com/vapi/api/resources/files/requests/CreateFileDto.java new file mode 100644 index 0000000..cb4d078 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/files/requests/CreateFileDto.java @@ -0,0 +1,59 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.files.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateFileDto.Builder.class) +public final class CreateFileDto { + private final Map additionalProperties; + + private CreateFileDto(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateFileDto; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateFileDto other) { + return this; + } + + public CreateFileDto build() { + return new CreateFileDto(additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/files/requests/UpdateFileDto.java b/src/main/java/com/vapi/api/resources/files/requests/UpdateFileDto.java new file mode 100644 index 0000000..0c6361b --- /dev/null +++ b/src/main/java/com/vapi/api/resources/files/requests/UpdateFileDto.java @@ -0,0 +1,98 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.files.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateFileDto.Builder.class) +public final class UpdateFileDto { + private final Optional name; + + private final Map additionalProperties; + + private UpdateFileDto(Optional name, Map additionalProperties) { + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the name of the file. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateFileDto && equalTo((UpdateFileDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateFileDto other) { + return name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateFileDto other) { + name(other.getName()); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public UpdateFileDto build() { + return new UpdateFileDto(name, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/logs/LogsClient.java b/src/main/java/com/vapi/api/resources/logs/LogsClient.java new file mode 100644 index 0000000..2b4eefe --- /dev/null +++ b/src/main/java/com/vapi/api/resources/logs/LogsClient.java @@ -0,0 +1,138 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.logs; + +import com.vapi.api.core.ClientOptions; +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.core.pagination.SyncPagingIterable; +import com.vapi.api.resources.logs.requests.LogsGetRequest; +import com.vapi.api.types.Log; +import com.vapi.api.types.LogsPaginatedResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class LogsClient { + protected final ClientOptions clientOptions; + + public LogsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public SyncPagingIterable get() { + return get(LogsGetRequest.builder().build()); + } + + public SyncPagingIterable get(LogsGetRequest request) { + return get(request, null); + } + + public SyncPagingIterable get(LogsGetRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("logs"); + if (request.getOrgId().isPresent()) { + httpUrl.addQueryParameter("orgId", request.getOrgId().get()); + } + if (request.getType().isPresent()) { + httpUrl.addQueryParameter("type", request.getType().get().toString()); + } + if (request.getAssistantId().isPresent()) { + httpUrl.addQueryParameter("assistantId", request.getAssistantId().get()); + } + if (request.getPhoneNumberId().isPresent()) { + httpUrl.addQueryParameter( + "phoneNumberId", request.getPhoneNumberId().get()); + } + if (request.getCustomerId().isPresent()) { + httpUrl.addQueryParameter("customerId", request.getCustomerId().get()); + } + if (request.getSquadId().isPresent()) { + httpUrl.addQueryParameter("squadId", request.getSquadId().get()); + } + if (request.getCallId().isPresent()) { + httpUrl.addQueryParameter("callId", request.getCallId().get()); + } + if (request.getPage().isPresent()) { + httpUrl.addQueryParameter("page", request.getPage().get().toString()); + } + if (request.getSortOrder().isPresent()) { + httpUrl.addQueryParameter("sortOrder", request.getSortOrder().get().toString()); + } + if (request.getLimit().isPresent()) { + httpUrl.addQueryParameter("limit", request.getLimit().get().toString()); + } + if (request.getCreatedAtGt().isPresent()) { + httpUrl.addQueryParameter( + "createdAtGt", request.getCreatedAtGt().get().toString()); + } + if (request.getCreatedAtLt().isPresent()) { + httpUrl.addQueryParameter( + "createdAtLt", request.getCreatedAtLt().get().toString()); + } + if (request.getCreatedAtGe().isPresent()) { + httpUrl.addQueryParameter( + "createdAtGe", request.getCreatedAtGe().get().toString()); + } + if (request.getCreatedAtLe().isPresent()) { + httpUrl.addQueryParameter( + "createdAtLe", request.getCreatedAtLe().get().toString()); + } + if (request.getUpdatedAtGt().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtGt", request.getUpdatedAtGt().get().toString()); + } + if (request.getUpdatedAtLt().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtLt", request.getUpdatedAtLt().get().toString()); + } + if (request.getUpdatedAtGe().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtGe", request.getUpdatedAtGe().get().toString()); + } + if (request.getUpdatedAtLe().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtLe", request.getUpdatedAtLe().get().toString()); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + LogsPaginatedResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), LogsPaginatedResponse.class); + double newPageNumber = request.getPage().map(page -> page + 1).orElse(1); + LogsGetRequest nextRequest = LogsGetRequest.builder() + .from(request) + .page(newPageNumber) + .build(); + List result = parsedResponse.getResults(); + return new SyncPagingIterable<>(true, result, () -> get(nextRequest, requestOptions)); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/logs/requests/LogsGetRequest.java b/src/main/java/com/vapi/api/resources/logs/requests/LogsGetRequest.java new file mode 100644 index 0000000..acdfd15 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/logs/requests/LogsGetRequest.java @@ -0,0 +1,599 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.logs.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import com.vapi.api.resources.logs.types.LogsGetRequestSortOrder; +import com.vapi.api.resources.logs.types.LogsGetRequestType; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LogsGetRequest.Builder.class) +public final class LogsGetRequest { + private final Optional orgId; + + private final Optional type; + + private final Optional assistantId; + + private final Optional phoneNumberId; + + private final Optional customerId; + + private final Optional squadId; + + private final Optional callId; + + private final Optional page; + + private final Optional sortOrder; + + private final Optional limit; + + private final Optional createdAtGt; + + private final Optional createdAtLt; + + private final Optional createdAtGe; + + private final Optional createdAtLe; + + private final Optional updatedAtGt; + + private final Optional updatedAtLt; + + private final Optional updatedAtGe; + + private final Optional updatedAtLe; + + private final Map additionalProperties; + + private LogsGetRequest( + Optional orgId, + Optional type, + Optional assistantId, + Optional phoneNumberId, + Optional customerId, + Optional squadId, + Optional callId, + Optional page, + Optional sortOrder, + Optional limit, + Optional createdAtGt, + Optional createdAtLt, + Optional createdAtGe, + Optional createdAtLe, + Optional updatedAtGt, + Optional updatedAtLt, + Optional updatedAtGe, + Optional updatedAtLe, + Map additionalProperties) { + this.orgId = orgId; + this.type = type; + this.assistantId = assistantId; + this.phoneNumberId = phoneNumberId; + this.customerId = customerId; + this.squadId = squadId; + this.callId = callId; + this.page = page; + this.sortOrder = sortOrder; + this.limit = limit; + this.createdAtGt = createdAtGt; + this.createdAtLt = createdAtLt; + this.createdAtGe = createdAtGe; + this.createdAtLe = createdAtLe; + this.updatedAtGt = updatedAtGt; + this.updatedAtLt = updatedAtLt; + this.updatedAtGe = updatedAtGe; + this.updatedAtLe = updatedAtLe; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the unique identifier for the org that this log belongs to. + */ + @JsonProperty("orgId") + public Optional getOrgId() { + return orgId; + } + + /** + * @return This is the type of the log. + */ + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return This is the ID of the assistant. + */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the ID of the phone number. + */ + @JsonProperty("phoneNumberId") + public Optional getPhoneNumberId() { + return phoneNumberId; + } + + /** + * @return This is the ID of the customer. + */ + @JsonProperty("customerId") + public Optional getCustomerId() { + return customerId; + } + + /** + * @return This is the ID of the squad. + */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is the ID of the call. + */ + @JsonProperty("callId") + public Optional getCallId() { + return callId; + } + + /** + * @return This is the page number to return. Defaults to 1. + */ + @JsonProperty("page") + public Optional getPage() { + return page; + } + + /** + * @return This is the sort order for pagination. Defaults to 'ASC'. + */ + @JsonProperty("sortOrder") + public Optional getSortOrder() { + return sortOrder; + } + + /** + * @return This is the maximum number of items to return. Defaults to 100. + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return This will return items where the createdAt is greater than the specified value. + */ + @JsonProperty("createdAtGt") + public Optional getCreatedAtGt() { + return createdAtGt; + } + + /** + * @return This will return items where the createdAt is less than the specified value. + */ + @JsonProperty("createdAtLt") + public Optional getCreatedAtLt() { + return createdAtLt; + } + + /** + * @return This will return items where the createdAt is greater than or equal to the specified value. + */ + @JsonProperty("createdAtGe") + public Optional getCreatedAtGe() { + return createdAtGe; + } + + /** + * @return This will return items where the createdAt is less than or equal to the specified value. + */ + @JsonProperty("createdAtLe") + public Optional getCreatedAtLe() { + return createdAtLe; + } + + /** + * @return This will return items where the updatedAt is greater than the specified value. + */ + @JsonProperty("updatedAtGt") + public Optional getUpdatedAtGt() { + return updatedAtGt; + } + + /** + * @return This will return items where the updatedAt is less than the specified value. + */ + @JsonProperty("updatedAtLt") + public Optional getUpdatedAtLt() { + return updatedAtLt; + } + + /** + * @return This will return items where the updatedAt is greater than or equal to the specified value. + */ + @JsonProperty("updatedAtGe") + public Optional getUpdatedAtGe() { + return updatedAtGe; + } + + /** + * @return This will return items where the updatedAt is less than or equal to the specified value. + */ + @JsonProperty("updatedAtLe") + public Optional getUpdatedAtLe() { + return updatedAtLe; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LogsGetRequest && equalTo((LogsGetRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LogsGetRequest other) { + return orgId.equals(other.orgId) + && type.equals(other.type) + && assistantId.equals(other.assistantId) + && phoneNumberId.equals(other.phoneNumberId) + && customerId.equals(other.customerId) + && squadId.equals(other.squadId) + && callId.equals(other.callId) + && page.equals(other.page) + && sortOrder.equals(other.sortOrder) + && limit.equals(other.limit) + && createdAtGt.equals(other.createdAtGt) + && createdAtLt.equals(other.createdAtLt) + && createdAtGe.equals(other.createdAtGe) + && createdAtLe.equals(other.createdAtLe) + && updatedAtGt.equals(other.updatedAtGt) + && updatedAtLt.equals(other.updatedAtLt) + && updatedAtGe.equals(other.updatedAtGe) + && updatedAtLe.equals(other.updatedAtLe); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.orgId, + this.type, + this.assistantId, + this.phoneNumberId, + this.customerId, + this.squadId, + this.callId, + this.page, + this.sortOrder, + this.limit, + this.createdAtGt, + this.createdAtLt, + this.createdAtGe, + this.createdAtLe, + this.updatedAtGt, + this.updatedAtLt, + this.updatedAtGe, + this.updatedAtLe); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional orgId = Optional.empty(); + + private Optional type = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional phoneNumberId = Optional.empty(); + + private Optional customerId = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional callId = Optional.empty(); + + private Optional page = Optional.empty(); + + private Optional sortOrder = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional createdAtGt = Optional.empty(); + + private Optional createdAtLt = Optional.empty(); + + private Optional createdAtGe = Optional.empty(); + + private Optional createdAtLe = Optional.empty(); + + private Optional updatedAtGt = Optional.empty(); + + private Optional updatedAtLt = Optional.empty(); + + private Optional updatedAtGe = Optional.empty(); + + private Optional updatedAtLe = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(LogsGetRequest other) { + orgId(other.getOrgId()); + type(other.getType()); + assistantId(other.getAssistantId()); + phoneNumberId(other.getPhoneNumberId()); + customerId(other.getCustomerId()); + squadId(other.getSquadId()); + callId(other.getCallId()); + page(other.getPage()); + sortOrder(other.getSortOrder()); + limit(other.getLimit()); + createdAtGt(other.getCreatedAtGt()); + createdAtLt(other.getCreatedAtLt()); + createdAtGe(other.getCreatedAtGe()); + createdAtLe(other.getCreatedAtLe()); + updatedAtGt(other.getUpdatedAtGt()); + updatedAtLt(other.getUpdatedAtLt()); + updatedAtGe(other.getUpdatedAtGe()); + updatedAtLe(other.getUpdatedAtLe()); + return this; + } + + @JsonSetter(value = "orgId", nulls = Nulls.SKIP) + public Builder orgId(Optional orgId) { + this.orgId = orgId; + return this; + } + + public Builder orgId(String orgId) { + this.orgId = Optional.ofNullable(orgId); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(LogsGetRequestType type) { + this.type = Optional.ofNullable(type); + return this; + } + + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public Builder assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + public Builder assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @JsonSetter(value = "phoneNumberId", nulls = Nulls.SKIP) + public Builder phoneNumberId(Optional phoneNumberId) { + this.phoneNumberId = phoneNumberId; + return this; + } + + public Builder phoneNumberId(String phoneNumberId) { + this.phoneNumberId = Optional.ofNullable(phoneNumberId); + return this; + } + + @JsonSetter(value = "customerId", nulls = Nulls.SKIP) + public Builder customerId(Optional customerId) { + this.customerId = customerId; + return this; + } + + public Builder customerId(String customerId) { + this.customerId = Optional.ofNullable(customerId); + return this; + } + + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public Builder squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + public Builder squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @JsonSetter(value = "callId", nulls = Nulls.SKIP) + public Builder callId(Optional callId) { + this.callId = callId; + return this; + } + + public Builder callId(String callId) { + this.callId = Optional.ofNullable(callId); + return this; + } + + @JsonSetter(value = "page", nulls = Nulls.SKIP) + public Builder page(Optional page) { + this.page = page; + return this; + } + + public Builder page(Double page) { + this.page = Optional.ofNullable(page); + return this; + } + + @JsonSetter(value = "sortOrder", nulls = Nulls.SKIP) + public Builder sortOrder(Optional sortOrder) { + this.sortOrder = sortOrder; + return this; + } + + public Builder sortOrder(LogsGetRequestSortOrder sortOrder) { + this.sortOrder = Optional.ofNullable(sortOrder); + return this; + } + + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Double limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + @JsonSetter(value = "createdAtGt", nulls = Nulls.SKIP) + public Builder createdAtGt(Optional createdAtGt) { + this.createdAtGt = createdAtGt; + return this; + } + + public Builder createdAtGt(OffsetDateTime createdAtGt) { + this.createdAtGt = Optional.ofNullable(createdAtGt); + return this; + } + + @JsonSetter(value = "createdAtLt", nulls = Nulls.SKIP) + public Builder createdAtLt(Optional createdAtLt) { + this.createdAtLt = createdAtLt; + return this; + } + + public Builder createdAtLt(OffsetDateTime createdAtLt) { + this.createdAtLt = Optional.ofNullable(createdAtLt); + return this; + } + + @JsonSetter(value = "createdAtGe", nulls = Nulls.SKIP) + public Builder createdAtGe(Optional createdAtGe) { + this.createdAtGe = createdAtGe; + return this; + } + + public Builder createdAtGe(OffsetDateTime createdAtGe) { + this.createdAtGe = Optional.ofNullable(createdAtGe); + return this; + } + + @JsonSetter(value = "createdAtLe", nulls = Nulls.SKIP) + public Builder createdAtLe(Optional createdAtLe) { + this.createdAtLe = createdAtLe; + return this; + } + + public Builder createdAtLe(OffsetDateTime createdAtLe) { + this.createdAtLe = Optional.ofNullable(createdAtLe); + return this; + } + + @JsonSetter(value = "updatedAtGt", nulls = Nulls.SKIP) + public Builder updatedAtGt(Optional updatedAtGt) { + this.updatedAtGt = updatedAtGt; + return this; + } + + public Builder updatedAtGt(OffsetDateTime updatedAtGt) { + this.updatedAtGt = Optional.ofNullable(updatedAtGt); + return this; + } + + @JsonSetter(value = "updatedAtLt", nulls = Nulls.SKIP) + public Builder updatedAtLt(Optional updatedAtLt) { + this.updatedAtLt = updatedAtLt; + return this; + } + + public Builder updatedAtLt(OffsetDateTime updatedAtLt) { + this.updatedAtLt = Optional.ofNullable(updatedAtLt); + return this; + } + + @JsonSetter(value = "updatedAtGe", nulls = Nulls.SKIP) + public Builder updatedAtGe(Optional updatedAtGe) { + this.updatedAtGe = updatedAtGe; + return this; + } + + public Builder updatedAtGe(OffsetDateTime updatedAtGe) { + this.updatedAtGe = Optional.ofNullable(updatedAtGe); + return this; + } + + @JsonSetter(value = "updatedAtLe", nulls = Nulls.SKIP) + public Builder updatedAtLe(Optional updatedAtLe) { + this.updatedAtLe = updatedAtLe; + return this; + } + + public Builder updatedAtLe(OffsetDateTime updatedAtLe) { + this.updatedAtLe = Optional.ofNullable(updatedAtLe); + return this; + } + + public LogsGetRequest build() { + return new LogsGetRequest( + orgId, + type, + assistantId, + phoneNumberId, + customerId, + squadId, + callId, + page, + sortOrder, + limit, + createdAtGt, + createdAtLt, + createdAtGe, + createdAtLe, + updatedAtGt, + updatedAtLt, + updatedAtGe, + updatedAtLe, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/logs/types/LogsGetRequestSortOrder.java b/src/main/java/com/vapi/api/resources/logs/types/LogsGetRequestSortOrder.java new file mode 100644 index 0000000..e2e5e61 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/logs/types/LogsGetRequestSortOrder.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.logs.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum LogsGetRequestSortOrder { + ASC("ASC"), + + DESC("DESC"); + + private final String value; + + LogsGetRequestSortOrder(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/resources/logs/types/LogsGetRequestType.java b/src/main/java/com/vapi/api/resources/logs/types/LogsGetRequestType.java new file mode 100644 index 0000000..2ed517a --- /dev/null +++ b/src/main/java/com/vapi/api/resources/logs/types/LogsGetRequestType.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.logs.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum LogsGetRequestType { + API("API"), + + WEBHOOK("Webhook"), + + CALL("Call"), + + PROVIDER("Provider"); + + private final String value; + + LogsGetRequestType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/resources/phonenumbers/PhoneNumbersClient.java b/src/main/java/com/vapi/api/resources/phonenumbers/PhoneNumbersClient.java new file mode 100644 index 0000000..da617ff --- /dev/null +++ b/src/main/java/com/vapi/api/resources/phonenumbers/PhoneNumbersClient.java @@ -0,0 +1,268 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.phonenumbers; + +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.phonenumbers.requests.PhoneNumbersListRequest; +import com.vapi.api.resources.phonenumbers.requests.UpdatePhoneNumberDto; +import com.vapi.api.resources.phonenumbers.types.PhoneNumbersCreateRequest; +import com.vapi.api.resources.phonenumbers.types.PhoneNumbersCreateResponse; +import com.vapi.api.resources.phonenumbers.types.PhoneNumbersDeleteResponse; +import com.vapi.api.resources.phonenumbers.types.PhoneNumbersGetResponse; +import com.vapi.api.resources.phonenumbers.types.PhoneNumbersListResponseItem; +import com.vapi.api.resources.phonenumbers.types.PhoneNumbersUpdateResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class PhoneNumbersClient { + protected final ClientOptions clientOptions; + + public PhoneNumbersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public List list() { + return list(PhoneNumbersListRequest.builder().build()); + } + + public List list(PhoneNumbersListRequest request) { + return list(request, null); + } + + public List list(PhoneNumbersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("phone-number"); + if (request.getLimit().isPresent()) { + httpUrl.addQueryParameter("limit", request.getLimit().get().toString()); + } + if (request.getCreatedAtGt().isPresent()) { + httpUrl.addQueryParameter( + "createdAtGt", request.getCreatedAtGt().get().toString()); + } + if (request.getCreatedAtLt().isPresent()) { + httpUrl.addQueryParameter( + "createdAtLt", request.getCreatedAtLt().get().toString()); + } + if (request.getCreatedAtGe().isPresent()) { + httpUrl.addQueryParameter( + "createdAtGe", request.getCreatedAtGe().get().toString()); + } + if (request.getCreatedAtLe().isPresent()) { + httpUrl.addQueryParameter( + "createdAtLe", request.getCreatedAtLe().get().toString()); + } + if (request.getUpdatedAtGt().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtGt", request.getUpdatedAtGt().get().toString()); + } + if (request.getUpdatedAtLt().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtLt", request.getUpdatedAtLt().get().toString()); + } + if (request.getUpdatedAtGe().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtGe", request.getUpdatedAtGe().get().toString()); + } + if (request.getUpdatedAtLe().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtLe", request.getUpdatedAtLe().get().toString()); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public PhoneNumbersCreateResponse create(PhoneNumbersCreateRequest request) { + return create(request, null); + } + + public PhoneNumbersCreateResponse create(PhoneNumbersCreateRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("phone-number") + .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) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), PhoneNumbersCreateResponse.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public PhoneNumbersGetResponse get(String id) { + return get(id, null); + } + + public PhoneNumbersGetResponse get(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("phone-number") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), PhoneNumbersGetResponse.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public PhoneNumbersDeleteResponse delete(String id) { + return delete(id, null); + } + + public PhoneNumbersDeleteResponse delete(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("phone-number") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), PhoneNumbersDeleteResponse.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public PhoneNumbersUpdateResponse update(String id) { + return update(id, UpdatePhoneNumberDto.builder().build()); + } + + public PhoneNumbersUpdateResponse update(String id, UpdatePhoneNumberDto request) { + return update(id, request, null); + } + + public PhoneNumbersUpdateResponse update(String id, UpdatePhoneNumberDto request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("phone-number") + .addPathSegment(id) + .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("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), PhoneNumbersUpdateResponse.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/phonenumbers/requests/PhoneNumbersListRequest.java b/src/main/java/com/vapi/api/resources/phonenumbers/requests/PhoneNumbersListRequest.java new file mode 100644 index 0000000..b82b751 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/phonenumbers/requests/PhoneNumbersListRequest.java @@ -0,0 +1,336 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.phonenumbers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PhoneNumbersListRequest.Builder.class) +public final class PhoneNumbersListRequest { + private final Optional limit; + + private final Optional createdAtGt; + + private final Optional createdAtLt; + + private final Optional createdAtGe; + + private final Optional createdAtLe; + + private final Optional updatedAtGt; + + private final Optional updatedAtLt; + + private final Optional updatedAtGe; + + private final Optional updatedAtLe; + + private final Map additionalProperties; + + private PhoneNumbersListRequest( + Optional limit, + Optional createdAtGt, + Optional createdAtLt, + Optional createdAtGe, + Optional createdAtLe, + Optional updatedAtGt, + Optional updatedAtLt, + Optional updatedAtGe, + Optional updatedAtLe, + Map additionalProperties) { + this.limit = limit; + this.createdAtGt = createdAtGt; + this.createdAtLt = createdAtLt; + this.createdAtGe = createdAtGe; + this.createdAtLe = createdAtLe; + this.updatedAtGt = updatedAtGt; + this.updatedAtLt = updatedAtLt; + this.updatedAtGe = updatedAtGe; + this.updatedAtLe = updatedAtLe; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the maximum number of items to return. Defaults to 100. + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return This will return items where the createdAt is greater than the specified value. + */ + @JsonProperty("createdAtGt") + public Optional getCreatedAtGt() { + return createdAtGt; + } + + /** + * @return This will return items where the createdAt is less than the specified value. + */ + @JsonProperty("createdAtLt") + public Optional getCreatedAtLt() { + return createdAtLt; + } + + /** + * @return This will return items where the createdAt is greater than or equal to the specified value. + */ + @JsonProperty("createdAtGe") + public Optional getCreatedAtGe() { + return createdAtGe; + } + + /** + * @return This will return items where the createdAt is less than or equal to the specified value. + */ + @JsonProperty("createdAtLe") + public Optional getCreatedAtLe() { + return createdAtLe; + } + + /** + * @return This will return items where the updatedAt is greater than the specified value. + */ + @JsonProperty("updatedAtGt") + public Optional getUpdatedAtGt() { + return updatedAtGt; + } + + /** + * @return This will return items where the updatedAt is less than the specified value. + */ + @JsonProperty("updatedAtLt") + public Optional getUpdatedAtLt() { + return updatedAtLt; + } + + /** + * @return This will return items where the updatedAt is greater than or equal to the specified value. + */ + @JsonProperty("updatedAtGe") + public Optional getUpdatedAtGe() { + return updatedAtGe; + } + + /** + * @return This will return items where the updatedAt is less than or equal to the specified value. + */ + @JsonProperty("updatedAtLe") + public Optional getUpdatedAtLe() { + return updatedAtLe; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PhoneNumbersListRequest && equalTo((PhoneNumbersListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PhoneNumbersListRequest other) { + return limit.equals(other.limit) + && createdAtGt.equals(other.createdAtGt) + && createdAtLt.equals(other.createdAtLt) + && createdAtGe.equals(other.createdAtGe) + && createdAtLe.equals(other.createdAtLe) + && updatedAtGt.equals(other.updatedAtGt) + && updatedAtLt.equals(other.updatedAtLt) + && updatedAtGe.equals(other.updatedAtGe) + && updatedAtLe.equals(other.updatedAtLe); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.limit, + this.createdAtGt, + this.createdAtLt, + this.createdAtGe, + this.createdAtLe, + this.updatedAtGt, + this.updatedAtLt, + this.updatedAtGe, + this.updatedAtLe); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional limit = Optional.empty(); + + private Optional createdAtGt = Optional.empty(); + + private Optional createdAtLt = Optional.empty(); + + private Optional createdAtGe = Optional.empty(); + + private Optional createdAtLe = Optional.empty(); + + private Optional updatedAtGt = Optional.empty(); + + private Optional updatedAtLt = Optional.empty(); + + private Optional updatedAtGe = Optional.empty(); + + private Optional updatedAtLe = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PhoneNumbersListRequest other) { + limit(other.getLimit()); + createdAtGt(other.getCreatedAtGt()); + createdAtLt(other.getCreatedAtLt()); + createdAtGe(other.getCreatedAtGe()); + createdAtLe(other.getCreatedAtLe()); + updatedAtGt(other.getUpdatedAtGt()); + updatedAtLt(other.getUpdatedAtLt()); + updatedAtGe(other.getUpdatedAtGe()); + updatedAtLe(other.getUpdatedAtLe()); + return this; + } + + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Double limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + @JsonSetter(value = "createdAtGt", nulls = Nulls.SKIP) + public Builder createdAtGt(Optional createdAtGt) { + this.createdAtGt = createdAtGt; + return this; + } + + public Builder createdAtGt(OffsetDateTime createdAtGt) { + this.createdAtGt = Optional.ofNullable(createdAtGt); + return this; + } + + @JsonSetter(value = "createdAtLt", nulls = Nulls.SKIP) + public Builder createdAtLt(Optional createdAtLt) { + this.createdAtLt = createdAtLt; + return this; + } + + public Builder createdAtLt(OffsetDateTime createdAtLt) { + this.createdAtLt = Optional.ofNullable(createdAtLt); + return this; + } + + @JsonSetter(value = "createdAtGe", nulls = Nulls.SKIP) + public Builder createdAtGe(Optional createdAtGe) { + this.createdAtGe = createdAtGe; + return this; + } + + public Builder createdAtGe(OffsetDateTime createdAtGe) { + this.createdAtGe = Optional.ofNullable(createdAtGe); + return this; + } + + @JsonSetter(value = "createdAtLe", nulls = Nulls.SKIP) + public Builder createdAtLe(Optional createdAtLe) { + this.createdAtLe = createdAtLe; + return this; + } + + public Builder createdAtLe(OffsetDateTime createdAtLe) { + this.createdAtLe = Optional.ofNullable(createdAtLe); + return this; + } + + @JsonSetter(value = "updatedAtGt", nulls = Nulls.SKIP) + public Builder updatedAtGt(Optional updatedAtGt) { + this.updatedAtGt = updatedAtGt; + return this; + } + + public Builder updatedAtGt(OffsetDateTime updatedAtGt) { + this.updatedAtGt = Optional.ofNullable(updatedAtGt); + return this; + } + + @JsonSetter(value = "updatedAtLt", nulls = Nulls.SKIP) + public Builder updatedAtLt(Optional updatedAtLt) { + this.updatedAtLt = updatedAtLt; + return this; + } + + public Builder updatedAtLt(OffsetDateTime updatedAtLt) { + this.updatedAtLt = Optional.ofNullable(updatedAtLt); + return this; + } + + @JsonSetter(value = "updatedAtGe", nulls = Nulls.SKIP) + public Builder updatedAtGe(Optional updatedAtGe) { + this.updatedAtGe = updatedAtGe; + return this; + } + + public Builder updatedAtGe(OffsetDateTime updatedAtGe) { + this.updatedAtGe = Optional.ofNullable(updatedAtGe); + return this; + } + + @JsonSetter(value = "updatedAtLe", nulls = Nulls.SKIP) + public Builder updatedAtLe(Optional updatedAtLe) { + this.updatedAtLe = updatedAtLe; + return this; + } + + public Builder updatedAtLe(OffsetDateTime updatedAtLe) { + this.updatedAtLe = Optional.ofNullable(updatedAtLe); + return this; + } + + public PhoneNumbersListRequest build() { + return new PhoneNumbersListRequest( + limit, + createdAtGt, + createdAtLt, + createdAtGe, + createdAtLe, + updatedAtGt, + updatedAtLt, + updatedAtGe, + updatedAtLe, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/phonenumbers/requests/UpdatePhoneNumberDto.java b/src/main/java/com/vapi/api/resources/phonenumbers/requests/UpdatePhoneNumberDto.java new file mode 100644 index 0000000..0d18c13 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/phonenumbers/requests/UpdatePhoneNumberDto.java @@ -0,0 +1,254 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.phonenumbers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import com.vapi.api.resources.phonenumbers.types.UpdatePhoneNumberDtoFallbackDestination; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePhoneNumberDto.Builder.class) +public final class UpdatePhoneNumberDto { + private final Optional fallbackDestination; + + private final Optional name; + + private final Optional assistantId; + + private final Optional squadId; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Map additionalProperties; + + private UpdatePhoneNumberDto( + Optional fallbackDestination, + Optional name, + Optional assistantId, + Optional squadId, + Optional serverUrl, + Optional serverUrlSecret, + Map additionalProperties) { + this.fallbackDestination = fallbackDestination; + this.name = name; + this.assistantId = assistantId; + this.squadId = squadId; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the fallback destination an inbound call will be transferred to if: + *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ */ + @JsonProperty("fallbackDestination") + public Optional getFallbackDestination() { + return fallbackDestination; + } + + /** + * @return This is the name of the phone number. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the assistant that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the squad that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message. + *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePhoneNumberDto && equalTo((UpdatePhoneNumberDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePhoneNumberDto other) { + return fallbackDestination.equals(other.fallbackDestination) + && name.equals(other.name) + && assistantId.equals(other.assistantId) + && squadId.equals(other.squadId) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fallbackDestination, + this.name, + this.assistantId, + this.squadId, + this.serverUrl, + this.serverUrlSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional fallbackDestination = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional serverUrlSecret = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdatePhoneNumberDto other) { + fallbackDestination(other.getFallbackDestination()); + name(other.getName()); + assistantId(other.getAssistantId()); + squadId(other.getSquadId()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + return this; + } + + @JsonSetter(value = "fallbackDestination", nulls = Nulls.SKIP) + public Builder fallbackDestination(Optional fallbackDestination) { + this.fallbackDestination = fallbackDestination; + return this; + } + + public Builder fallbackDestination(UpdatePhoneNumberDtoFallbackDestination fallbackDestination) { + this.fallbackDestination = Optional.ofNullable(fallbackDestination); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public Builder assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + public Builder assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public Builder squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + public Builder squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public Builder serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + public Builder serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public Builder serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + public Builder serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + public UpdatePhoneNumberDto build() { + return new UpdatePhoneNumberDto( + fallbackDestination, name, assistantId, squadId, serverUrl, serverUrlSecret, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersCreateRequest.java b/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersCreateRequest.java new file mode 100644 index 0000000..0e95777 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersCreateRequest.java @@ -0,0 +1,319 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.phonenumbers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.CreateByoPhoneNumberDto; +import com.vapi.api.types.CreateTwilioPhoneNumberDto; +import com.vapi.api.types.CreateVapiPhoneNumberDto; +import com.vapi.api.types.CreateVonagePhoneNumberDto; +import java.util.Objects; +import java.util.Optional; + +public final class PhoneNumbersCreateRequest { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PhoneNumbersCreateRequest(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PhoneNumbersCreateRequest byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new PhoneNumbersCreateRequest(new ByoPhoneNumberValue(value)); + } + + public static PhoneNumbersCreateRequest twilio(CreateTwilioPhoneNumberDto value) { + return new PhoneNumbersCreateRequest(new TwilioValue(value)); + } + + public static PhoneNumbersCreateRequest vonage(CreateVonagePhoneNumberDto value) { + return new PhoneNumbersCreateRequest(new VonageValue(value)); + } + + public static PhoneNumbersCreateRequest vapi(CreateVapiPhoneNumberDto value) { + return new PhoneNumbersCreateRequest(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersCreateRequest{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersCreateRequest{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersCreateRequest{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersCreateRequest{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersCreateRequest{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersCreateResponse.java b/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersCreateResponse.java new file mode 100644 index 0000000..c5f9539 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersCreateResponse.java @@ -0,0 +1,319 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.phonenumbers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.ByoPhoneNumber; +import com.vapi.api.types.TwilioPhoneNumber; +import com.vapi.api.types.VapiPhoneNumber; +import com.vapi.api.types.VonagePhoneNumber; +import java.util.Objects; +import java.util.Optional; + +public final class PhoneNumbersCreateResponse { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PhoneNumbersCreateResponse(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PhoneNumbersCreateResponse byoPhoneNumber(ByoPhoneNumber value) { + return new PhoneNumbersCreateResponse(new ByoPhoneNumberValue(value)); + } + + public static PhoneNumbersCreateResponse twilio(TwilioPhoneNumber value) { + return new PhoneNumbersCreateResponse(new TwilioValue(value)); + } + + public static PhoneNumbersCreateResponse vonage(VonagePhoneNumber value) { + return new PhoneNumbersCreateResponse(new VonageValue(value)); + } + + public static PhoneNumbersCreateResponse vapi(VapiPhoneNumber value) { + return new PhoneNumbersCreateResponse(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(ByoPhoneNumber byoPhoneNumber); + + T visitTwilio(TwilioPhoneNumber twilio); + + T visitVonage(VonagePhoneNumber vonage); + + T visitVapi(VapiPhoneNumber vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private ByoPhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(ByoPhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersCreateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private TwilioPhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(TwilioPhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersCreateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private VonagePhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(VonagePhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersCreateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private VapiPhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(VapiPhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersCreateResponse{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersCreateResponse{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersDeleteResponse.java b/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersDeleteResponse.java new file mode 100644 index 0000000..36808f3 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersDeleteResponse.java @@ -0,0 +1,319 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.phonenumbers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.ByoPhoneNumber; +import com.vapi.api.types.TwilioPhoneNumber; +import com.vapi.api.types.VapiPhoneNumber; +import com.vapi.api.types.VonagePhoneNumber; +import java.util.Objects; +import java.util.Optional; + +public final class PhoneNumbersDeleteResponse { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PhoneNumbersDeleteResponse(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PhoneNumbersDeleteResponse byoPhoneNumber(ByoPhoneNumber value) { + return new PhoneNumbersDeleteResponse(new ByoPhoneNumberValue(value)); + } + + public static PhoneNumbersDeleteResponse twilio(TwilioPhoneNumber value) { + return new PhoneNumbersDeleteResponse(new TwilioValue(value)); + } + + public static PhoneNumbersDeleteResponse vonage(VonagePhoneNumber value) { + return new PhoneNumbersDeleteResponse(new VonageValue(value)); + } + + public static PhoneNumbersDeleteResponse vapi(VapiPhoneNumber value) { + return new PhoneNumbersDeleteResponse(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(ByoPhoneNumber byoPhoneNumber); + + T visitTwilio(TwilioPhoneNumber twilio); + + T visitVonage(VonagePhoneNumber vonage); + + T visitVapi(VapiPhoneNumber vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private ByoPhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(ByoPhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersDeleteResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private TwilioPhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(TwilioPhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersDeleteResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private VonagePhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(VonagePhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersDeleteResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private VapiPhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(VapiPhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersDeleteResponse{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersDeleteResponse{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersGetResponse.java b/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersGetResponse.java new file mode 100644 index 0000000..2e62b03 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersGetResponse.java @@ -0,0 +1,319 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.phonenumbers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.ByoPhoneNumber; +import com.vapi.api.types.TwilioPhoneNumber; +import com.vapi.api.types.VapiPhoneNumber; +import com.vapi.api.types.VonagePhoneNumber; +import java.util.Objects; +import java.util.Optional; + +public final class PhoneNumbersGetResponse { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PhoneNumbersGetResponse(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PhoneNumbersGetResponse byoPhoneNumber(ByoPhoneNumber value) { + return new PhoneNumbersGetResponse(new ByoPhoneNumberValue(value)); + } + + public static PhoneNumbersGetResponse twilio(TwilioPhoneNumber value) { + return new PhoneNumbersGetResponse(new TwilioValue(value)); + } + + public static PhoneNumbersGetResponse vonage(VonagePhoneNumber value) { + return new PhoneNumbersGetResponse(new VonageValue(value)); + } + + public static PhoneNumbersGetResponse vapi(VapiPhoneNumber value) { + return new PhoneNumbersGetResponse(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(ByoPhoneNumber byoPhoneNumber); + + T visitTwilio(TwilioPhoneNumber twilio); + + T visitVonage(VonagePhoneNumber vonage); + + T visitVapi(VapiPhoneNumber vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private ByoPhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(ByoPhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersGetResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private TwilioPhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(TwilioPhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersGetResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private VonagePhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(VonagePhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersGetResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private VapiPhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(VapiPhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersGetResponse{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersGetResponse{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersListResponseItem.java b/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersListResponseItem.java new file mode 100644 index 0000000..94bbef2 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersListResponseItem.java @@ -0,0 +1,319 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.phonenumbers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.ByoPhoneNumber; +import com.vapi.api.types.TwilioPhoneNumber; +import com.vapi.api.types.VapiPhoneNumber; +import com.vapi.api.types.VonagePhoneNumber; +import java.util.Objects; +import java.util.Optional; + +public final class PhoneNumbersListResponseItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PhoneNumbersListResponseItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PhoneNumbersListResponseItem byoPhoneNumber(ByoPhoneNumber value) { + return new PhoneNumbersListResponseItem(new ByoPhoneNumberValue(value)); + } + + public static PhoneNumbersListResponseItem twilio(TwilioPhoneNumber value) { + return new PhoneNumbersListResponseItem(new TwilioValue(value)); + } + + public static PhoneNumbersListResponseItem vonage(VonagePhoneNumber value) { + return new PhoneNumbersListResponseItem(new VonageValue(value)); + } + + public static PhoneNumbersListResponseItem vapi(VapiPhoneNumber value) { + return new PhoneNumbersListResponseItem(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(ByoPhoneNumber byoPhoneNumber); + + T visitTwilio(TwilioPhoneNumber twilio); + + T visitVonage(VonagePhoneNumber vonage); + + T visitVapi(VapiPhoneNumber vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private ByoPhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(ByoPhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersListResponseItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private TwilioPhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(TwilioPhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersListResponseItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private VonagePhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(VonagePhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersListResponseItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private VapiPhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(VapiPhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersListResponseItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersListResponseItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersUpdateResponse.java b/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersUpdateResponse.java new file mode 100644 index 0000000..9d4e3af --- /dev/null +++ b/src/main/java/com/vapi/api/resources/phonenumbers/types/PhoneNumbersUpdateResponse.java @@ -0,0 +1,319 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.phonenumbers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.ByoPhoneNumber; +import com.vapi.api.types.TwilioPhoneNumber; +import com.vapi.api.types.VapiPhoneNumber; +import com.vapi.api.types.VonagePhoneNumber; +import java.util.Objects; +import java.util.Optional; + +public final class PhoneNumbersUpdateResponse { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PhoneNumbersUpdateResponse(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PhoneNumbersUpdateResponse byoPhoneNumber(ByoPhoneNumber value) { + return new PhoneNumbersUpdateResponse(new ByoPhoneNumberValue(value)); + } + + public static PhoneNumbersUpdateResponse twilio(TwilioPhoneNumber value) { + return new PhoneNumbersUpdateResponse(new TwilioValue(value)); + } + + public static PhoneNumbersUpdateResponse vonage(VonagePhoneNumber value) { + return new PhoneNumbersUpdateResponse(new VonageValue(value)); + } + + public static PhoneNumbersUpdateResponse vapi(VapiPhoneNumber value) { + return new PhoneNumbersUpdateResponse(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(ByoPhoneNumber byoPhoneNumber); + + T visitTwilio(TwilioPhoneNumber twilio); + + T visitVonage(VonagePhoneNumber vonage); + + T visitVapi(VapiPhoneNumber vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private ByoPhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(ByoPhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersUpdateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private TwilioPhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(TwilioPhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersUpdateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private VonagePhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(VonagePhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersUpdateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private VapiPhoneNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(VapiPhoneNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersUpdateResponse{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PhoneNumbersUpdateResponse{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/phonenumbers/types/UpdatePhoneNumberDtoFallbackDestination.java b/src/main/java/com/vapi/api/resources/phonenumbers/types/UpdatePhoneNumberDtoFallbackDestination.java new file mode 100644 index 0000000..daf34cd --- /dev/null +++ b/src/main/java/com/vapi/api/resources/phonenumbers/types/UpdatePhoneNumberDtoFallbackDestination.java @@ -0,0 +1,202 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.phonenumbers.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.TransferDestinationNumber; +import com.vapi.api.types.TransferDestinationSip; +import java.util.Objects; +import java.util.Optional; + +public final class UpdatePhoneNumberDtoFallbackDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private UpdatePhoneNumberDtoFallbackDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static UpdatePhoneNumberDtoFallbackDestination number(TransferDestinationNumber value) { + return new UpdatePhoneNumberDtoFallbackDestination(new NumberValue(value)); + } + + public static UpdatePhoneNumberDtoFallbackDestination sip(TransferDestinationSip value) { + return new UpdatePhoneNumberDtoFallbackDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdatePhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdatePhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "UpdatePhoneNumberDtoFallbackDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/squads/SquadsClient.java b/src/main/java/com/vapi/api/resources/squads/SquadsClient.java new file mode 100644 index 0000000..cf86e14 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/squads/SquadsClient.java @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.squads; + +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.squads.requests.SquadsListRequest; +import com.vapi.api.resources.squads.requests.UpdateSquadDto; +import com.vapi.api.types.CreateSquadDto; +import com.vapi.api.types.Squad; +import java.io.IOException; +import java.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class SquadsClient { + protected final ClientOptions clientOptions; + + public SquadsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public List list() { + return list(SquadsListRequest.builder().build()); + } + + public List list(SquadsListRequest request) { + return list(request, null); + } + + public List list(SquadsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("squad"); + if (request.getLimit().isPresent()) { + httpUrl.addQueryParameter("limit", request.getLimit().get().toString()); + } + if (request.getCreatedAtGt().isPresent()) { + httpUrl.addQueryParameter( + "createdAtGt", request.getCreatedAtGt().get().toString()); + } + if (request.getCreatedAtLt().isPresent()) { + httpUrl.addQueryParameter( + "createdAtLt", request.getCreatedAtLt().get().toString()); + } + if (request.getCreatedAtGe().isPresent()) { + httpUrl.addQueryParameter( + "createdAtGe", request.getCreatedAtGe().get().toString()); + } + if (request.getCreatedAtLe().isPresent()) { + httpUrl.addQueryParameter( + "createdAtLe", request.getCreatedAtLe().get().toString()); + } + if (request.getUpdatedAtGt().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtGt", request.getUpdatedAtGt().get().toString()); + } + if (request.getUpdatedAtLt().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtLt", request.getUpdatedAtLt().get().toString()); + } + if (request.getUpdatedAtGe().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtGe", request.getUpdatedAtGe().get().toString()); + } + if (request.getUpdatedAtLe().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtLe", request.getUpdatedAtLe().get().toString()); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), new TypeReference>() {}); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public Squad create(CreateSquadDto request) { + return create(request, null); + } + + public Squad create(CreateSquadDto request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("squad") + .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) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Squad.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public Squad get(String id) { + return get(id, null); + } + + public Squad get(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("squad") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Squad.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public Squad delete(String id) { + return delete(id, null); + } + + public Squad delete(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("squad") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Squad.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public Squad update(String id, UpdateSquadDto request) { + return update(id, request, null); + } + + public Squad update(String id, UpdateSquadDto request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("squad") + .addPathSegment(id) + .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("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Squad.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/squads/requests/SquadsListRequest.java b/src/main/java/com/vapi/api/resources/squads/requests/SquadsListRequest.java new file mode 100644 index 0000000..5f15c19 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/squads/requests/SquadsListRequest.java @@ -0,0 +1,336 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.squads.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SquadsListRequest.Builder.class) +public final class SquadsListRequest { + private final Optional limit; + + private final Optional createdAtGt; + + private final Optional createdAtLt; + + private final Optional createdAtGe; + + private final Optional createdAtLe; + + private final Optional updatedAtGt; + + private final Optional updatedAtLt; + + private final Optional updatedAtGe; + + private final Optional updatedAtLe; + + private final Map additionalProperties; + + private SquadsListRequest( + Optional limit, + Optional createdAtGt, + Optional createdAtLt, + Optional createdAtGe, + Optional createdAtLe, + Optional updatedAtGt, + Optional updatedAtLt, + Optional updatedAtGe, + Optional updatedAtLe, + Map additionalProperties) { + this.limit = limit; + this.createdAtGt = createdAtGt; + this.createdAtLt = createdAtLt; + this.createdAtGe = createdAtGe; + this.createdAtLe = createdAtLe; + this.updatedAtGt = updatedAtGt; + this.updatedAtLt = updatedAtLt; + this.updatedAtGe = updatedAtGe; + this.updatedAtLe = updatedAtLe; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the maximum number of items to return. Defaults to 100. + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return This will return items where the createdAt is greater than the specified value. + */ + @JsonProperty("createdAtGt") + public Optional getCreatedAtGt() { + return createdAtGt; + } + + /** + * @return This will return items where the createdAt is less than the specified value. + */ + @JsonProperty("createdAtLt") + public Optional getCreatedAtLt() { + return createdAtLt; + } + + /** + * @return This will return items where the createdAt is greater than or equal to the specified value. + */ + @JsonProperty("createdAtGe") + public Optional getCreatedAtGe() { + return createdAtGe; + } + + /** + * @return This will return items where the createdAt is less than or equal to the specified value. + */ + @JsonProperty("createdAtLe") + public Optional getCreatedAtLe() { + return createdAtLe; + } + + /** + * @return This will return items where the updatedAt is greater than the specified value. + */ + @JsonProperty("updatedAtGt") + public Optional getUpdatedAtGt() { + return updatedAtGt; + } + + /** + * @return This will return items where the updatedAt is less than the specified value. + */ + @JsonProperty("updatedAtLt") + public Optional getUpdatedAtLt() { + return updatedAtLt; + } + + /** + * @return This will return items where the updatedAt is greater than or equal to the specified value. + */ + @JsonProperty("updatedAtGe") + public Optional getUpdatedAtGe() { + return updatedAtGe; + } + + /** + * @return This will return items where the updatedAt is less than or equal to the specified value. + */ + @JsonProperty("updatedAtLe") + public Optional getUpdatedAtLe() { + return updatedAtLe; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SquadsListRequest && equalTo((SquadsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SquadsListRequest other) { + return limit.equals(other.limit) + && createdAtGt.equals(other.createdAtGt) + && createdAtLt.equals(other.createdAtLt) + && createdAtGe.equals(other.createdAtGe) + && createdAtLe.equals(other.createdAtLe) + && updatedAtGt.equals(other.updatedAtGt) + && updatedAtLt.equals(other.updatedAtLt) + && updatedAtGe.equals(other.updatedAtGe) + && updatedAtLe.equals(other.updatedAtLe); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.limit, + this.createdAtGt, + this.createdAtLt, + this.createdAtGe, + this.createdAtLe, + this.updatedAtGt, + this.updatedAtLt, + this.updatedAtGe, + this.updatedAtLe); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional limit = Optional.empty(); + + private Optional createdAtGt = Optional.empty(); + + private Optional createdAtLt = Optional.empty(); + + private Optional createdAtGe = Optional.empty(); + + private Optional createdAtLe = Optional.empty(); + + private Optional updatedAtGt = Optional.empty(); + + private Optional updatedAtLt = Optional.empty(); + + private Optional updatedAtGe = Optional.empty(); + + private Optional updatedAtLe = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SquadsListRequest other) { + limit(other.getLimit()); + createdAtGt(other.getCreatedAtGt()); + createdAtLt(other.getCreatedAtLt()); + createdAtGe(other.getCreatedAtGe()); + createdAtLe(other.getCreatedAtLe()); + updatedAtGt(other.getUpdatedAtGt()); + updatedAtLt(other.getUpdatedAtLt()); + updatedAtGe(other.getUpdatedAtGe()); + updatedAtLe(other.getUpdatedAtLe()); + return this; + } + + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Double limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + @JsonSetter(value = "createdAtGt", nulls = Nulls.SKIP) + public Builder createdAtGt(Optional createdAtGt) { + this.createdAtGt = createdAtGt; + return this; + } + + public Builder createdAtGt(OffsetDateTime createdAtGt) { + this.createdAtGt = Optional.ofNullable(createdAtGt); + return this; + } + + @JsonSetter(value = "createdAtLt", nulls = Nulls.SKIP) + public Builder createdAtLt(Optional createdAtLt) { + this.createdAtLt = createdAtLt; + return this; + } + + public Builder createdAtLt(OffsetDateTime createdAtLt) { + this.createdAtLt = Optional.ofNullable(createdAtLt); + return this; + } + + @JsonSetter(value = "createdAtGe", nulls = Nulls.SKIP) + public Builder createdAtGe(Optional createdAtGe) { + this.createdAtGe = createdAtGe; + return this; + } + + public Builder createdAtGe(OffsetDateTime createdAtGe) { + this.createdAtGe = Optional.ofNullable(createdAtGe); + return this; + } + + @JsonSetter(value = "createdAtLe", nulls = Nulls.SKIP) + public Builder createdAtLe(Optional createdAtLe) { + this.createdAtLe = createdAtLe; + return this; + } + + public Builder createdAtLe(OffsetDateTime createdAtLe) { + this.createdAtLe = Optional.ofNullable(createdAtLe); + return this; + } + + @JsonSetter(value = "updatedAtGt", nulls = Nulls.SKIP) + public Builder updatedAtGt(Optional updatedAtGt) { + this.updatedAtGt = updatedAtGt; + return this; + } + + public Builder updatedAtGt(OffsetDateTime updatedAtGt) { + this.updatedAtGt = Optional.ofNullable(updatedAtGt); + return this; + } + + @JsonSetter(value = "updatedAtLt", nulls = Nulls.SKIP) + public Builder updatedAtLt(Optional updatedAtLt) { + this.updatedAtLt = updatedAtLt; + return this; + } + + public Builder updatedAtLt(OffsetDateTime updatedAtLt) { + this.updatedAtLt = Optional.ofNullable(updatedAtLt); + return this; + } + + @JsonSetter(value = "updatedAtGe", nulls = Nulls.SKIP) + public Builder updatedAtGe(Optional updatedAtGe) { + this.updatedAtGe = updatedAtGe; + return this; + } + + public Builder updatedAtGe(OffsetDateTime updatedAtGe) { + this.updatedAtGe = Optional.ofNullable(updatedAtGe); + return this; + } + + @JsonSetter(value = "updatedAtLe", nulls = Nulls.SKIP) + public Builder updatedAtLe(Optional updatedAtLe) { + this.updatedAtLe = updatedAtLe; + return this; + } + + public Builder updatedAtLe(OffsetDateTime updatedAtLe) { + this.updatedAtLe = Optional.ofNullable(updatedAtLe); + return this; + } + + public SquadsListRequest build() { + return new SquadsListRequest( + limit, + createdAtGt, + createdAtLt, + createdAtGe, + createdAtLe, + updatedAtGt, + updatedAtLt, + updatedAtGe, + updatedAtLe, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/squads/requests/UpdateSquadDto.java b/src/main/java/com/vapi/api/resources/squads/requests/UpdateSquadDto.java new file mode 100644 index 0000000..3480e9c --- /dev/null +++ b/src/main/java/com/vapi/api/resources/squads/requests/UpdateSquadDto.java @@ -0,0 +1,166 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.squads.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import com.vapi.api.types.AssistantOverrides; +import com.vapi.api.types.SquadMemberDto; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateSquadDto.Builder.class) +public final class UpdateSquadDto { + private final Optional name; + + private final List members; + + private final Optional membersOverrides; + + private final Map additionalProperties; + + private UpdateSquadDto( + Optional name, + List members, + Optional membersOverrides, + Map additionalProperties) { + this.name = name; + this.members = members; + this.membersOverrides = membersOverrides; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the name of the squad. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the list of assistants that make up the squad. + *

The call will start with the first assistant in the list.

+ */ + @JsonProperty("members") + public List getMembers() { + return members; + } + + /** + * @return This can be used to override all the assistants' settings and provide values for their template variables. + *

Both membersOverrides and members[n].assistantOverrides can be used together. First, members[n].assistantOverrides is applied. Then, membersOverrides is applied as a global override.

+ */ + @JsonProperty("membersOverrides") + public Optional getMembersOverrides() { + return membersOverrides; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateSquadDto && equalTo((UpdateSquadDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateSquadDto other) { + return name.equals(other.name) + && members.equals(other.members) + && membersOverrides.equals(other.membersOverrides); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.members, this.membersOverrides); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private List members = new ArrayList<>(); + + private Optional membersOverrides = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateSquadDto other) { + name(other.getName()); + members(other.getMembers()); + membersOverrides(other.getMembersOverrides()); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "members", nulls = Nulls.SKIP) + public Builder members(List members) { + this.members.clear(); + this.members.addAll(members); + return this; + } + + public Builder addMembers(SquadMemberDto members) { + this.members.add(members); + return this; + } + + public Builder addAllMembers(List members) { + this.members.addAll(members); + return this; + } + + @JsonSetter(value = "membersOverrides", nulls = Nulls.SKIP) + public Builder membersOverrides(Optional membersOverrides) { + this.membersOverrides = membersOverrides; + return this; + } + + public Builder membersOverrides(AssistantOverrides membersOverrides) { + this.membersOverrides = Optional.ofNullable(membersOverrides); + return this; + } + + public UpdateSquadDto build() { + return new UpdateSquadDto(name, members, membersOverrides, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/tools/ToolsClient.java b/src/main/java/com/vapi/api/resources/tools/ToolsClient.java new file mode 100644 index 0000000..6d9da31 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/tools/ToolsClient.java @@ -0,0 +1,268 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.tools; + +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.tools.requests.ToolsListRequest; +import com.vapi.api.resources.tools.requests.UpdateToolDto; +import com.vapi.api.resources.tools.types.ToolsCreateRequest; +import com.vapi.api.resources.tools.types.ToolsCreateResponse; +import com.vapi.api.resources.tools.types.ToolsDeleteResponse; +import com.vapi.api.resources.tools.types.ToolsGetResponse; +import com.vapi.api.resources.tools.types.ToolsListResponseItem; +import com.vapi.api.resources.tools.types.ToolsUpdateResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class ToolsClient { + protected final ClientOptions clientOptions; + + public ToolsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public List list() { + return list(ToolsListRequest.builder().build()); + } + + public List list(ToolsListRequest request) { + return list(request, null); + } + + public List list(ToolsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("tool"); + if (request.getLimit().isPresent()) { + httpUrl.addQueryParameter("limit", request.getLimit().get().toString()); + } + if (request.getCreatedAtGt().isPresent()) { + httpUrl.addQueryParameter( + "createdAtGt", request.getCreatedAtGt().get().toString()); + } + if (request.getCreatedAtLt().isPresent()) { + httpUrl.addQueryParameter( + "createdAtLt", request.getCreatedAtLt().get().toString()); + } + if (request.getCreatedAtGe().isPresent()) { + httpUrl.addQueryParameter( + "createdAtGe", request.getCreatedAtGe().get().toString()); + } + if (request.getCreatedAtLe().isPresent()) { + httpUrl.addQueryParameter( + "createdAtLe", request.getCreatedAtLe().get().toString()); + } + if (request.getUpdatedAtGt().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtGt", request.getUpdatedAtGt().get().toString()); + } + if (request.getUpdatedAtLt().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtLt", request.getUpdatedAtLt().get().toString()); + } + if (request.getUpdatedAtGe().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtGe", request.getUpdatedAtGe().get().toString()); + } + if (request.getUpdatedAtLe().isPresent()) { + httpUrl.addQueryParameter( + "updatedAtLe", request.getUpdatedAtLe().get().toString()); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public ToolsCreateResponse create(ToolsCreateRequest request) { + return create(request, null); + } + + public ToolsCreateResponse create(ToolsCreateRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("tool") + .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) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ToolsCreateResponse.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public ToolsGetResponse get(String id) { + return get(id, null); + } + + public ToolsGetResponse get(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("tool") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ToolsGetResponse.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public ToolsDeleteResponse delete(String id) { + return delete(id, null); + } + + public ToolsDeleteResponse delete(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("tool") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ToolsDeleteResponse.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } + + public ToolsUpdateResponse update(String id) { + return update(id, UpdateToolDto.builder().build()); + } + + public ToolsUpdateResponse update(String id, UpdateToolDto request) { + return update(id, request, null); + } + + public ToolsUpdateResponse update(String id, UpdateToolDto request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("tool") + .addPathSegment(id) + .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("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ToolsUpdateResponse.class); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new VapiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class)); + } catch (IOException e) { + throw new VapiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/tools/requests/ToolsListRequest.java b/src/main/java/com/vapi/api/resources/tools/requests/ToolsListRequest.java new file mode 100644 index 0000000..d1d5913 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/tools/requests/ToolsListRequest.java @@ -0,0 +1,336 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.tools.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ToolsListRequest.Builder.class) +public final class ToolsListRequest { + private final Optional limit; + + private final Optional createdAtGt; + + private final Optional createdAtLt; + + private final Optional createdAtGe; + + private final Optional createdAtLe; + + private final Optional updatedAtGt; + + private final Optional updatedAtLt; + + private final Optional updatedAtGe; + + private final Optional updatedAtLe; + + private final Map additionalProperties; + + private ToolsListRequest( + Optional limit, + Optional createdAtGt, + Optional createdAtLt, + Optional createdAtGe, + Optional createdAtLe, + Optional updatedAtGt, + Optional updatedAtLt, + Optional updatedAtGe, + Optional updatedAtLe, + Map additionalProperties) { + this.limit = limit; + this.createdAtGt = createdAtGt; + this.createdAtLt = createdAtLt; + this.createdAtGe = createdAtGe; + this.createdAtLe = createdAtLe; + this.updatedAtGt = updatedAtGt; + this.updatedAtLt = updatedAtLt; + this.updatedAtGe = updatedAtGe; + this.updatedAtLe = updatedAtLe; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the maximum number of items to return. Defaults to 100. + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return This will return items where the createdAt is greater than the specified value. + */ + @JsonProperty("createdAtGt") + public Optional getCreatedAtGt() { + return createdAtGt; + } + + /** + * @return This will return items where the createdAt is less than the specified value. + */ + @JsonProperty("createdAtLt") + public Optional getCreatedAtLt() { + return createdAtLt; + } + + /** + * @return This will return items where the createdAt is greater than or equal to the specified value. + */ + @JsonProperty("createdAtGe") + public Optional getCreatedAtGe() { + return createdAtGe; + } + + /** + * @return This will return items where the createdAt is less than or equal to the specified value. + */ + @JsonProperty("createdAtLe") + public Optional getCreatedAtLe() { + return createdAtLe; + } + + /** + * @return This will return items where the updatedAt is greater than the specified value. + */ + @JsonProperty("updatedAtGt") + public Optional getUpdatedAtGt() { + return updatedAtGt; + } + + /** + * @return This will return items where the updatedAt is less than the specified value. + */ + @JsonProperty("updatedAtLt") + public Optional getUpdatedAtLt() { + return updatedAtLt; + } + + /** + * @return This will return items where the updatedAt is greater than or equal to the specified value. + */ + @JsonProperty("updatedAtGe") + public Optional getUpdatedAtGe() { + return updatedAtGe; + } + + /** + * @return This will return items where the updatedAt is less than or equal to the specified value. + */ + @JsonProperty("updatedAtLe") + public Optional getUpdatedAtLe() { + return updatedAtLe; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolsListRequest && equalTo((ToolsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ToolsListRequest other) { + return limit.equals(other.limit) + && createdAtGt.equals(other.createdAtGt) + && createdAtLt.equals(other.createdAtLt) + && createdAtGe.equals(other.createdAtGe) + && createdAtLe.equals(other.createdAtLe) + && updatedAtGt.equals(other.updatedAtGt) + && updatedAtLt.equals(other.updatedAtLt) + && updatedAtGe.equals(other.updatedAtGe) + && updatedAtLe.equals(other.updatedAtLe); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.limit, + this.createdAtGt, + this.createdAtLt, + this.createdAtGe, + this.createdAtLe, + this.updatedAtGt, + this.updatedAtLt, + this.updatedAtGe, + this.updatedAtLe); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional limit = Optional.empty(); + + private Optional createdAtGt = Optional.empty(); + + private Optional createdAtLt = Optional.empty(); + + private Optional createdAtGe = Optional.empty(); + + private Optional createdAtLe = Optional.empty(); + + private Optional updatedAtGt = Optional.empty(); + + private Optional updatedAtLt = Optional.empty(); + + private Optional updatedAtGe = Optional.empty(); + + private Optional updatedAtLe = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ToolsListRequest other) { + limit(other.getLimit()); + createdAtGt(other.getCreatedAtGt()); + createdAtLt(other.getCreatedAtLt()); + createdAtGe(other.getCreatedAtGe()); + createdAtLe(other.getCreatedAtLe()); + updatedAtGt(other.getUpdatedAtGt()); + updatedAtLt(other.getUpdatedAtLt()); + updatedAtGe(other.getUpdatedAtGe()); + updatedAtLe(other.getUpdatedAtLe()); + return this; + } + + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Double limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + @JsonSetter(value = "createdAtGt", nulls = Nulls.SKIP) + public Builder createdAtGt(Optional createdAtGt) { + this.createdAtGt = createdAtGt; + return this; + } + + public Builder createdAtGt(OffsetDateTime createdAtGt) { + this.createdAtGt = Optional.ofNullable(createdAtGt); + return this; + } + + @JsonSetter(value = "createdAtLt", nulls = Nulls.SKIP) + public Builder createdAtLt(Optional createdAtLt) { + this.createdAtLt = createdAtLt; + return this; + } + + public Builder createdAtLt(OffsetDateTime createdAtLt) { + this.createdAtLt = Optional.ofNullable(createdAtLt); + return this; + } + + @JsonSetter(value = "createdAtGe", nulls = Nulls.SKIP) + public Builder createdAtGe(Optional createdAtGe) { + this.createdAtGe = createdAtGe; + return this; + } + + public Builder createdAtGe(OffsetDateTime createdAtGe) { + this.createdAtGe = Optional.ofNullable(createdAtGe); + return this; + } + + @JsonSetter(value = "createdAtLe", nulls = Nulls.SKIP) + public Builder createdAtLe(Optional createdAtLe) { + this.createdAtLe = createdAtLe; + return this; + } + + public Builder createdAtLe(OffsetDateTime createdAtLe) { + this.createdAtLe = Optional.ofNullable(createdAtLe); + return this; + } + + @JsonSetter(value = "updatedAtGt", nulls = Nulls.SKIP) + public Builder updatedAtGt(Optional updatedAtGt) { + this.updatedAtGt = updatedAtGt; + return this; + } + + public Builder updatedAtGt(OffsetDateTime updatedAtGt) { + this.updatedAtGt = Optional.ofNullable(updatedAtGt); + return this; + } + + @JsonSetter(value = "updatedAtLt", nulls = Nulls.SKIP) + public Builder updatedAtLt(Optional updatedAtLt) { + this.updatedAtLt = updatedAtLt; + return this; + } + + public Builder updatedAtLt(OffsetDateTime updatedAtLt) { + this.updatedAtLt = Optional.ofNullable(updatedAtLt); + return this; + } + + @JsonSetter(value = "updatedAtGe", nulls = Nulls.SKIP) + public Builder updatedAtGe(Optional updatedAtGe) { + this.updatedAtGe = updatedAtGe; + return this; + } + + public Builder updatedAtGe(OffsetDateTime updatedAtGe) { + this.updatedAtGe = Optional.ofNullable(updatedAtGe); + return this; + } + + @JsonSetter(value = "updatedAtLe", nulls = Nulls.SKIP) + public Builder updatedAtLe(Optional updatedAtLe) { + this.updatedAtLe = updatedAtLe; + return this; + } + + public Builder updatedAtLe(OffsetDateTime updatedAtLe) { + this.updatedAtLe = Optional.ofNullable(updatedAtLe); + return this; + } + + public ToolsListRequest build() { + return new ToolsListRequest( + limit, + createdAtGt, + createdAtLt, + createdAtGe, + createdAtLe, + updatedAtGt, + updatedAtLt, + updatedAtGe, + updatedAtLe, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/tools/requests/UpdateToolDto.java b/src/main/java/com/vapi/api/resources/tools/requests/UpdateToolDto.java new file mode 100644 index 0000000..5429063 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/tools/requests/UpdateToolDto.java @@ -0,0 +1,193 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.tools.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import com.vapi.api.resources.tools.types.UpdateToolDtoMessagesItem; +import com.vapi.api.types.OpenAiFunction; +import com.vapi.api.types.Server; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateToolDto.Builder.class) +public final class UpdateToolDto { + private final Optional async; + + private final Optional> messages; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private UpdateToolDto( + Optional async, + Optional> messages, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateToolDto && equalTo((UpdateToolDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateToolDto other) { + return async.equals(other.async) + && messages.equals(other.messages) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.async, this.messages, this.function, this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional async = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional server = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateToolDto other) { + async(other.getAsync()); + messages(other.getMessages()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public Builder async(Optional async) { + this.async = async; + return this; + } + + public Builder async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public Builder function(Optional function) { + this.function = function; + return this; + } + + public Builder function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public Builder server(Optional server) { + this.server = server; + return this; + } + + public Builder server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + public UpdateToolDto build() { + return new UpdateToolDto(async, messages, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/resources/tools/types/ToolsCreateRequest.java b/src/main/java/com/vapi/api/resources/tools/types/ToolsCreateRequest.java new file mode 100644 index 0000000..2ea0777 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/tools/types/ToolsCreateRequest.java @@ -0,0 +1,490 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.tools.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.CreateDtmfToolDto; +import com.vapi.api.types.CreateEndCallToolDto; +import com.vapi.api.types.CreateFunctionToolDto; +import com.vapi.api.types.CreateGhlToolDto; +import com.vapi.api.types.CreateMakeToolDto; +import com.vapi.api.types.CreateOutputToolDto; +import com.vapi.api.types.CreateTransferCallToolDto; +import java.util.Objects; +import java.util.Optional; + +public final class ToolsCreateRequest { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ToolsCreateRequest(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ToolsCreateRequest dtmf(CreateDtmfToolDto value) { + return new ToolsCreateRequest(new DtmfValue(value)); + } + + public static ToolsCreateRequest endCall(CreateEndCallToolDto value) { + return new ToolsCreateRequest(new EndCallValue(value)); + } + + public static ToolsCreateRequest function(CreateFunctionToolDto value) { + return new ToolsCreateRequest(new FunctionValue(value)); + } + + public static ToolsCreateRequest ghl(CreateGhlToolDto value) { + return new ToolsCreateRequest(new GhlValue(value)); + } + + public static ToolsCreateRequest make(CreateMakeToolDto value) { + return new ToolsCreateRequest(new MakeValue(value)); + } + + public static ToolsCreateRequest transferCall(CreateTransferCallToolDto value) { + return new ToolsCreateRequest(new TransferCallValue(value)); + } + + public static ToolsCreateRequest output(CreateOutputToolDto value) { + return new ToolsCreateRequest(new OutputValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean isOutput() { + return value instanceof OutputValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getOutput() { + if (isOutput()) { + return Optional.of(((OutputValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T visitOutput(CreateOutputToolDto output); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class), + @JsonSubTypes.Type(OutputValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateRequest{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateRequest{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateRequest{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateRequest{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateRequest{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateRequest{" + "value: " + value + "}"; + } + } + + @JsonTypeName("output") + private static final class OutputValue implements Value { + @JsonUnwrapped + private CreateOutputToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OutputValue() {} + + private OutputValue(CreateOutputToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOutput(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OutputValue && equalTo((OutputValue) other); + } + + private boolean equalTo(OutputValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateRequest{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateRequest{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/tools/types/ToolsCreateResponse.java b/src/main/java/com/vapi/api/resources/tools/types/ToolsCreateResponse.java new file mode 100644 index 0000000..77b9f5b --- /dev/null +++ b/src/main/java/com/vapi/api/resources/tools/types/ToolsCreateResponse.java @@ -0,0 +1,490 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.tools.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.DtmfTool; +import com.vapi.api.types.EndCallTool; +import com.vapi.api.types.FunctionTool; +import com.vapi.api.types.GhlTool; +import com.vapi.api.types.MakeTool; +import com.vapi.api.types.OutputTool; +import com.vapi.api.types.TransferCallTool; +import java.util.Objects; +import java.util.Optional; + +public final class ToolsCreateResponse { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ToolsCreateResponse(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ToolsCreateResponse dtmf(DtmfTool value) { + return new ToolsCreateResponse(new DtmfValue(value)); + } + + public static ToolsCreateResponse endCall(EndCallTool value) { + return new ToolsCreateResponse(new EndCallValue(value)); + } + + public static ToolsCreateResponse function(FunctionTool value) { + return new ToolsCreateResponse(new FunctionValue(value)); + } + + public static ToolsCreateResponse ghl(GhlTool value) { + return new ToolsCreateResponse(new GhlValue(value)); + } + + public static ToolsCreateResponse make(MakeTool value) { + return new ToolsCreateResponse(new MakeValue(value)); + } + + public static ToolsCreateResponse transferCall(TransferCallTool value) { + return new ToolsCreateResponse(new TransferCallValue(value)); + } + + public static ToolsCreateResponse output(OutputTool value) { + return new ToolsCreateResponse(new OutputValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean isOutput() { + return value instanceof OutputValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getOutput() { + if (isOutput()) { + return Optional.of(((OutputValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(DtmfTool dtmf); + + T visitEndCall(EndCallTool endCall); + + T visitFunction(FunctionTool function); + + T visitGhl(GhlTool ghl); + + T visitMake(MakeTool make); + + T visitTransferCall(TransferCallTool transferCall); + + T visitOutput(OutputTool output); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class), + @JsonSubTypes.Type(OutputValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private DtmfTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(DtmfTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private EndCallTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(EndCallTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private FunctionTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(FunctionTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private GhlTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(GhlTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private MakeTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(MakeTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private TransferCallTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(TransferCallTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("output") + private static final class OutputValue implements Value { + @JsonUnwrapped + private OutputTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OutputValue() {} + + private OutputValue(OutputTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOutput(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OutputValue && equalTo((OutputValue) other); + } + + private boolean equalTo(OutputValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateResponse{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsCreateResponse{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/tools/types/ToolsDeleteResponse.java b/src/main/java/com/vapi/api/resources/tools/types/ToolsDeleteResponse.java new file mode 100644 index 0000000..dad6055 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/tools/types/ToolsDeleteResponse.java @@ -0,0 +1,490 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.tools.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.DtmfTool; +import com.vapi.api.types.EndCallTool; +import com.vapi.api.types.FunctionTool; +import com.vapi.api.types.GhlTool; +import com.vapi.api.types.MakeTool; +import com.vapi.api.types.OutputTool; +import com.vapi.api.types.TransferCallTool; +import java.util.Objects; +import java.util.Optional; + +public final class ToolsDeleteResponse { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ToolsDeleteResponse(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ToolsDeleteResponse dtmf(DtmfTool value) { + return new ToolsDeleteResponse(new DtmfValue(value)); + } + + public static ToolsDeleteResponse endCall(EndCallTool value) { + return new ToolsDeleteResponse(new EndCallValue(value)); + } + + public static ToolsDeleteResponse function(FunctionTool value) { + return new ToolsDeleteResponse(new FunctionValue(value)); + } + + public static ToolsDeleteResponse ghl(GhlTool value) { + return new ToolsDeleteResponse(new GhlValue(value)); + } + + public static ToolsDeleteResponse make(MakeTool value) { + return new ToolsDeleteResponse(new MakeValue(value)); + } + + public static ToolsDeleteResponse transferCall(TransferCallTool value) { + return new ToolsDeleteResponse(new TransferCallValue(value)); + } + + public static ToolsDeleteResponse output(OutputTool value) { + return new ToolsDeleteResponse(new OutputValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean isOutput() { + return value instanceof OutputValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getOutput() { + if (isOutput()) { + return Optional.of(((OutputValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(DtmfTool dtmf); + + T visitEndCall(EndCallTool endCall); + + T visitFunction(FunctionTool function); + + T visitGhl(GhlTool ghl); + + T visitMake(MakeTool make); + + T visitTransferCall(TransferCallTool transferCall); + + T visitOutput(OutputTool output); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class), + @JsonSubTypes.Type(OutputValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private DtmfTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(DtmfTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsDeleteResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private EndCallTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(EndCallTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsDeleteResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private FunctionTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(FunctionTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsDeleteResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private GhlTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(GhlTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsDeleteResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private MakeTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(MakeTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsDeleteResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private TransferCallTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(TransferCallTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsDeleteResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("output") + private static final class OutputValue implements Value { + @JsonUnwrapped + private OutputTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OutputValue() {} + + private OutputValue(OutputTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOutput(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OutputValue && equalTo((OutputValue) other); + } + + private boolean equalTo(OutputValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsDeleteResponse{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsDeleteResponse{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/tools/types/ToolsGetResponse.java b/src/main/java/com/vapi/api/resources/tools/types/ToolsGetResponse.java new file mode 100644 index 0000000..3649efa --- /dev/null +++ b/src/main/java/com/vapi/api/resources/tools/types/ToolsGetResponse.java @@ -0,0 +1,490 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.tools.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.DtmfTool; +import com.vapi.api.types.EndCallTool; +import com.vapi.api.types.FunctionTool; +import com.vapi.api.types.GhlTool; +import com.vapi.api.types.MakeTool; +import com.vapi.api.types.OutputTool; +import com.vapi.api.types.TransferCallTool; +import java.util.Objects; +import java.util.Optional; + +public final class ToolsGetResponse { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ToolsGetResponse(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ToolsGetResponse dtmf(DtmfTool value) { + return new ToolsGetResponse(new DtmfValue(value)); + } + + public static ToolsGetResponse endCall(EndCallTool value) { + return new ToolsGetResponse(new EndCallValue(value)); + } + + public static ToolsGetResponse function(FunctionTool value) { + return new ToolsGetResponse(new FunctionValue(value)); + } + + public static ToolsGetResponse ghl(GhlTool value) { + return new ToolsGetResponse(new GhlValue(value)); + } + + public static ToolsGetResponse make(MakeTool value) { + return new ToolsGetResponse(new MakeValue(value)); + } + + public static ToolsGetResponse transferCall(TransferCallTool value) { + return new ToolsGetResponse(new TransferCallValue(value)); + } + + public static ToolsGetResponse output(OutputTool value) { + return new ToolsGetResponse(new OutputValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean isOutput() { + return value instanceof OutputValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getOutput() { + if (isOutput()) { + return Optional.of(((OutputValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(DtmfTool dtmf); + + T visitEndCall(EndCallTool endCall); + + T visitFunction(FunctionTool function); + + T visitGhl(GhlTool ghl); + + T visitMake(MakeTool make); + + T visitTransferCall(TransferCallTool transferCall); + + T visitOutput(OutputTool output); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class), + @JsonSubTypes.Type(OutputValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private DtmfTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(DtmfTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsGetResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private EndCallTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(EndCallTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsGetResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private FunctionTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(FunctionTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsGetResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private GhlTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(GhlTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsGetResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private MakeTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(MakeTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsGetResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private TransferCallTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(TransferCallTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsGetResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("output") + private static final class OutputValue implements Value { + @JsonUnwrapped + private OutputTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OutputValue() {} + + private OutputValue(OutputTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOutput(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OutputValue && equalTo((OutputValue) other); + } + + private boolean equalTo(OutputValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsGetResponse{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsGetResponse{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/tools/types/ToolsListResponseItem.java b/src/main/java/com/vapi/api/resources/tools/types/ToolsListResponseItem.java new file mode 100644 index 0000000..ea26199 --- /dev/null +++ b/src/main/java/com/vapi/api/resources/tools/types/ToolsListResponseItem.java @@ -0,0 +1,490 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.tools.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.DtmfTool; +import com.vapi.api.types.EndCallTool; +import com.vapi.api.types.FunctionTool; +import com.vapi.api.types.GhlTool; +import com.vapi.api.types.MakeTool; +import com.vapi.api.types.OutputTool; +import com.vapi.api.types.TransferCallTool; +import java.util.Objects; +import java.util.Optional; + +public final class ToolsListResponseItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ToolsListResponseItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ToolsListResponseItem dtmf(DtmfTool value) { + return new ToolsListResponseItem(new DtmfValue(value)); + } + + public static ToolsListResponseItem endCall(EndCallTool value) { + return new ToolsListResponseItem(new EndCallValue(value)); + } + + public static ToolsListResponseItem function(FunctionTool value) { + return new ToolsListResponseItem(new FunctionValue(value)); + } + + public static ToolsListResponseItem ghl(GhlTool value) { + return new ToolsListResponseItem(new GhlValue(value)); + } + + public static ToolsListResponseItem make(MakeTool value) { + return new ToolsListResponseItem(new MakeValue(value)); + } + + public static ToolsListResponseItem transferCall(TransferCallTool value) { + return new ToolsListResponseItem(new TransferCallValue(value)); + } + + public static ToolsListResponseItem output(OutputTool value) { + return new ToolsListResponseItem(new OutputValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean isOutput() { + return value instanceof OutputValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getOutput() { + if (isOutput()) { + return Optional.of(((OutputValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(DtmfTool dtmf); + + T visitEndCall(EndCallTool endCall); + + T visitFunction(FunctionTool function); + + T visitGhl(GhlTool ghl); + + T visitMake(MakeTool make); + + T visitTransferCall(TransferCallTool transferCall); + + T visitOutput(OutputTool output); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class), + @JsonSubTypes.Type(OutputValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private DtmfTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(DtmfTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsListResponseItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private EndCallTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(EndCallTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsListResponseItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private FunctionTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(FunctionTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsListResponseItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private GhlTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(GhlTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsListResponseItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private MakeTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(MakeTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsListResponseItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private TransferCallTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(TransferCallTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsListResponseItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("output") + private static final class OutputValue implements Value { + @JsonUnwrapped + private OutputTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OutputValue() {} + + private OutputValue(OutputTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOutput(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OutputValue && equalTo((OutputValue) other); + } + + private boolean equalTo(OutputValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsListResponseItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsListResponseItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/tools/types/ToolsUpdateResponse.java b/src/main/java/com/vapi/api/resources/tools/types/ToolsUpdateResponse.java new file mode 100644 index 0000000..220f09f --- /dev/null +++ b/src/main/java/com/vapi/api/resources/tools/types/ToolsUpdateResponse.java @@ -0,0 +1,490 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.tools.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.DtmfTool; +import com.vapi.api.types.EndCallTool; +import com.vapi.api.types.FunctionTool; +import com.vapi.api.types.GhlTool; +import com.vapi.api.types.MakeTool; +import com.vapi.api.types.OutputTool; +import com.vapi.api.types.TransferCallTool; +import java.util.Objects; +import java.util.Optional; + +public final class ToolsUpdateResponse { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ToolsUpdateResponse(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ToolsUpdateResponse dtmf(DtmfTool value) { + return new ToolsUpdateResponse(new DtmfValue(value)); + } + + public static ToolsUpdateResponse endCall(EndCallTool value) { + return new ToolsUpdateResponse(new EndCallValue(value)); + } + + public static ToolsUpdateResponse function(FunctionTool value) { + return new ToolsUpdateResponse(new FunctionValue(value)); + } + + public static ToolsUpdateResponse ghl(GhlTool value) { + return new ToolsUpdateResponse(new GhlValue(value)); + } + + public static ToolsUpdateResponse make(MakeTool value) { + return new ToolsUpdateResponse(new MakeValue(value)); + } + + public static ToolsUpdateResponse transferCall(TransferCallTool value) { + return new ToolsUpdateResponse(new TransferCallValue(value)); + } + + public static ToolsUpdateResponse output(OutputTool value) { + return new ToolsUpdateResponse(new OutputValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean isOutput() { + return value instanceof OutputValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getOutput() { + if (isOutput()) { + return Optional.of(((OutputValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(DtmfTool dtmf); + + T visitEndCall(EndCallTool endCall); + + T visitFunction(FunctionTool function); + + T visitGhl(GhlTool ghl); + + T visitMake(MakeTool make); + + T visitTransferCall(TransferCallTool transferCall); + + T visitOutput(OutputTool output); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class), + @JsonSubTypes.Type(OutputValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private DtmfTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(DtmfTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsUpdateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private EndCallTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(EndCallTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsUpdateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private FunctionTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(FunctionTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsUpdateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private GhlTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(GhlTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsUpdateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private MakeTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(MakeTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsUpdateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private TransferCallTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(TransferCallTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsUpdateResponse{" + "value: " + value + "}"; + } + } + + @JsonTypeName("output") + private static final class OutputValue implements Value { + @JsonUnwrapped + private OutputTool value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OutputValue() {} + + private OutputValue(OutputTool value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOutput(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OutputValue && equalTo((OutputValue) other); + } + + private boolean equalTo(OutputValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsUpdateResponse{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ToolsUpdateResponse{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/resources/tools/types/UpdateToolDtoMessagesItem.java b/src/main/java/com/vapi/api/resources/tools/types/UpdateToolDtoMessagesItem.java new file mode 100644 index 0000000..0a0f6ef --- /dev/null +++ b/src/main/java/com/vapi/api/resources/tools/types/UpdateToolDtoMessagesItem.java @@ -0,0 +1,319 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.resources.tools.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import com.vapi.api.types.ToolMessageComplete; +import com.vapi.api.types.ToolMessageDelayed; +import com.vapi.api.types.ToolMessageFailed; +import com.vapi.api.types.ToolMessageStart; +import java.util.Objects; +import java.util.Optional; + +public final class UpdateToolDtoMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private UpdateToolDtoMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static UpdateToolDtoMessagesItem requestStart(ToolMessageStart value) { + return new UpdateToolDtoMessagesItem(new RequestStartValue(value)); + } + + public static UpdateToolDtoMessagesItem requestComplete(ToolMessageComplete value) { + return new UpdateToolDtoMessagesItem(new RequestCompleteValue(value)); + } + + public static UpdateToolDtoMessagesItem requestFailed(ToolMessageFailed value) { + return new UpdateToolDtoMessagesItem(new RequestFailedValue(value)); + } + + public static UpdateToolDtoMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new UpdateToolDtoMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolDtoMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/AddVoiceToProviderDto.java b/src/main/java/com/vapi/api/types/AddVoiceToProviderDto.java new file mode 100644 index 0000000..9134df7 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AddVoiceToProviderDto.java @@ -0,0 +1,168 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AddVoiceToProviderDto.Builder.class) +public final class AddVoiceToProviderDto { + private final String ownerId; + + private final String voiceId; + + private final String name; + + private final Map additionalProperties; + + private AddVoiceToProviderDto( + String ownerId, String voiceId, String name, Map additionalProperties) { + this.ownerId = ownerId; + this.voiceId = voiceId; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the owner_id of your shared voice which you want to add to your provider Account from Provider Voice Library + */ + @JsonProperty("ownerId") + public String getOwnerId() { + return ownerId; + } + + /** + * @return This is the voice_id of the shared voice which you want to add to your provider Account from Provider Voice Library + */ + @JsonProperty("voiceId") + public String getVoiceId() { + return voiceId; + } + + /** + * @return This is the new name of the voice which you want to have once you have added voice to your provider Account from Provider Voice Library + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AddVoiceToProviderDto && equalTo((AddVoiceToProviderDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AddVoiceToProviderDto other) { + return ownerId.equals(other.ownerId) && voiceId.equals(other.voiceId) && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.ownerId, this.voiceId, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static OwnerIdStage builder() { + return new Builder(); + } + + public interface OwnerIdStage { + VoiceIdStage ownerId(@NotNull String ownerId); + + Builder from(AddVoiceToProviderDto other); + } + + public interface VoiceIdStage { + NameStage voiceId(@NotNull String voiceId); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + AddVoiceToProviderDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements OwnerIdStage, VoiceIdStage, NameStage, _FinalStage { + private String ownerId; + + private String voiceId; + + private String name; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AddVoiceToProviderDto other) { + ownerId(other.getOwnerId()); + voiceId(other.getVoiceId()); + name(other.getName()); + return this; + } + + /** + *

This is the owner_id of your shared voice which you want to add to your provider Account from Provider Voice Library

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ownerId") + public VoiceIdStage ownerId(@NotNull String ownerId) { + this.ownerId = Objects.requireNonNull(ownerId, "ownerId must not be null"); + return this; + } + + /** + *

This is the voice_id of the shared voice which you want to add to your provider Account from Provider Voice Library

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("voiceId") + public NameStage voiceId(@NotNull String voiceId) { + this.voiceId = Objects.requireNonNull(voiceId, "voiceId must not be null"); + return this; + } + + /** + *

This is the new name of the voice which you want to have once you have added voice to your provider Account from Provider Voice Library

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public AddVoiceToProviderDto build() { + return new AddVoiceToProviderDto(ownerId, voiceId, name, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/Analysis.java b/src/main/java/com/vapi/api/types/Analysis.java new file mode 100644 index 0000000..550c069 --- /dev/null +++ b/src/main/java/com/vapi/api/types/Analysis.java @@ -0,0 +1,154 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Analysis.Builder.class) +public final class Analysis { + private final Optional summary; + + private final Optional> structuredData; + + private final Optional successEvaluation; + + private final Map additionalProperties; + + private Analysis( + Optional summary, + Optional> structuredData, + Optional successEvaluation, + Map additionalProperties) { + this.summary = summary; + this.structuredData = structuredData; + this.successEvaluation = successEvaluation; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the summary of the call. Customize by setting assistant.analysisPlan.summaryPrompt. + */ + @JsonProperty("summary") + public Optional getSummary() { + return summary; + } + + /** + * @return This is the structured data extracted from the call. Customize by setting assistant.analysisPlan.structuredDataPrompt and/or assistant.analysisPlan.structuredDataSchema. + */ + @JsonProperty("structuredData") + public Optional> getStructuredData() { + return structuredData; + } + + /** + * @return This is the evaluation of the call. Customize by setting assistant.analysisPlan.successEvaluationPrompt and/or assistant.analysisPlan.successEvaluationRubric. + */ + @JsonProperty("successEvaluation") + public Optional getSuccessEvaluation() { + return successEvaluation; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Analysis && equalTo((Analysis) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Analysis other) { + return summary.equals(other.summary) + && structuredData.equals(other.structuredData) + && successEvaluation.equals(other.successEvaluation); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.summary, this.structuredData, this.successEvaluation); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional summary = Optional.empty(); + + private Optional> structuredData = Optional.empty(); + + private Optional successEvaluation = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(Analysis other) { + summary(other.getSummary()); + structuredData(other.getStructuredData()); + successEvaluation(other.getSuccessEvaluation()); + return this; + } + + @JsonSetter(value = "summary", nulls = Nulls.SKIP) + public Builder summary(Optional summary) { + this.summary = summary; + return this; + } + + public Builder summary(String summary) { + this.summary = Optional.ofNullable(summary); + return this; + } + + @JsonSetter(value = "structuredData", nulls = Nulls.SKIP) + public Builder structuredData(Optional> structuredData) { + this.structuredData = structuredData; + return this; + } + + public Builder structuredData(Map structuredData) { + this.structuredData = Optional.ofNullable(structuredData); + return this; + } + + @JsonSetter(value = "successEvaluation", nulls = Nulls.SKIP) + public Builder successEvaluation(Optional successEvaluation) { + this.successEvaluation = successEvaluation; + return this; + } + + public Builder successEvaluation(String successEvaluation) { + this.successEvaluation = Optional.ofNullable(successEvaluation); + return this; + } + + public Analysis build() { + return new Analysis(summary, structuredData, successEvaluation, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AnalysisCost.java b/src/main/java/com/vapi/api/types/AnalysisCost.java new file mode 100644 index 0000000..84dbe5e --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnalysisCost.java @@ -0,0 +1,257 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AnalysisCost.Builder.class) +public final class AnalysisCost { + private final AnalysisCostAnalysisType analysisType; + + private final Map model; + + private final double promptTokens; + + private final double completionTokens; + + private final double cost; + + private final Map additionalProperties; + + private AnalysisCost( + AnalysisCostAnalysisType analysisType, + Map model, + double promptTokens, + double completionTokens, + double cost, + Map additionalProperties) { + this.analysisType = analysisType; + this.model = model; + this.promptTokens = promptTokens; + this.completionTokens = completionTokens; + this.cost = cost; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the type of analysis performed. + */ + @JsonProperty("analysisType") + public AnalysisCostAnalysisType getAnalysisType() { + return analysisType; + } + + /** + * @return This is the model that was used to perform the analysis. + */ + @JsonProperty("model") + public Map getModel() { + return model; + } + + /** + * @return This is the number of prompt tokens used in the analysis. + */ + @JsonProperty("promptTokens") + public double getPromptTokens() { + return promptTokens; + } + + /** + * @return This is the number of completion tokens generated in the analysis. + */ + @JsonProperty("completionTokens") + public double getCompletionTokens() { + return completionTokens; + } + + /** + * @return This is the cost of the component in USD. + */ + @JsonProperty("cost") + public double getCost() { + return cost; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnalysisCost && equalTo((AnalysisCost) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AnalysisCost other) { + return analysisType.equals(other.analysisType) + && model.equals(other.model) + && promptTokens == other.promptTokens + && completionTokens == other.completionTokens + && cost == other.cost; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.analysisType, this.model, this.promptTokens, this.completionTokens, this.cost); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AnalysisTypeStage builder() { + return new Builder(); + } + + public interface AnalysisTypeStage { + PromptTokensStage analysisType(@NotNull AnalysisCostAnalysisType analysisType); + + Builder from(AnalysisCost other); + } + + public interface PromptTokensStage { + CompletionTokensStage promptTokens(double promptTokens); + } + + public interface CompletionTokensStage { + CostStage completionTokens(double completionTokens); + } + + public interface CostStage { + _FinalStage cost(double cost); + } + + public interface _FinalStage { + AnalysisCost build(); + + _FinalStage model(Map model); + + _FinalStage putAllModel(Map model); + + _FinalStage model(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AnalysisTypeStage, PromptTokensStage, CompletionTokensStage, CostStage, _FinalStage { + private AnalysisCostAnalysisType analysisType; + + private double promptTokens; + + private double completionTokens; + + private double cost; + + private Map model = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AnalysisCost other) { + analysisType(other.getAnalysisType()); + model(other.getModel()); + promptTokens(other.getPromptTokens()); + completionTokens(other.getCompletionTokens()); + cost(other.getCost()); + return this; + } + + /** + *

This is the type of analysis performed.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("analysisType") + public PromptTokensStage analysisType(@NotNull AnalysisCostAnalysisType analysisType) { + this.analysisType = Objects.requireNonNull(analysisType, "analysisType must not be null"); + return this; + } + + /** + *

This is the number of prompt tokens used in the analysis.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("promptTokens") + public CompletionTokensStage promptTokens(double promptTokens) { + this.promptTokens = promptTokens; + return this; + } + + /** + *

This is the number of completion tokens generated in the analysis.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completionTokens") + public CostStage completionTokens(double completionTokens) { + this.completionTokens = completionTokens; + return this; + } + + /** + *

This is the cost of the component in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cost") + public _FinalStage cost(double cost) { + this.cost = cost; + return this; + } + + /** + *

This is the model that was used to perform the analysis.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage model(String key, Object value) { + this.model.put(key, value); + return this; + } + + /** + *

This is the model that was used to perform the analysis.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllModel(Map model) { + this.model.putAll(model); + return this; + } + + @java.lang.Override + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public _FinalStage model(Map model) { + this.model.clear(); + this.model.putAll(model); + return this; + } + + @java.lang.Override + public AnalysisCost build() { + return new AnalysisCost(analysisType, model, promptTokens, completionTokens, cost, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AnalysisCostAnalysisType.java b/src/main/java/com/vapi/api/types/AnalysisCostAnalysisType.java new file mode 100644 index 0000000..7b99267 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnalysisCostAnalysisType.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AnalysisCostAnalysisType { + SUMMARY("summary"), + + STRUCTURED_DATA("structuredData"), + + SUCCESS_EVALUATION("successEvaluation"); + + private final String value; + + AnalysisCostAnalysisType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/AnalysisCostBreakdown.java b/src/main/java/com/vapi/api/types/AnalysisCostBreakdown.java new file mode 100644 index 0000000..997f040 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnalysisCostBreakdown.java @@ -0,0 +1,335 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AnalysisCostBreakdown.Builder.class) +public final class AnalysisCostBreakdown { + private final Optional summary; + + private final Optional summaryPromptTokens; + + private final Optional summaryCompletionTokens; + + private final Optional structuredData; + + private final Optional structuredDataPromptTokens; + + private final Optional structuredDataCompletionTokens; + + private final Optional successEvaluation; + + private final Optional successEvaluationPromptTokens; + + private final Optional successEvaluationCompletionTokens; + + private final Map additionalProperties; + + private AnalysisCostBreakdown( + Optional summary, + Optional summaryPromptTokens, + Optional summaryCompletionTokens, + Optional structuredData, + Optional structuredDataPromptTokens, + Optional structuredDataCompletionTokens, + Optional successEvaluation, + Optional successEvaluationPromptTokens, + Optional successEvaluationCompletionTokens, + Map additionalProperties) { + this.summary = summary; + this.summaryPromptTokens = summaryPromptTokens; + this.summaryCompletionTokens = summaryCompletionTokens; + this.structuredData = structuredData; + this.structuredDataPromptTokens = structuredDataPromptTokens; + this.structuredDataCompletionTokens = structuredDataCompletionTokens; + this.successEvaluation = successEvaluation; + this.successEvaluationPromptTokens = successEvaluationPromptTokens; + this.successEvaluationCompletionTokens = successEvaluationCompletionTokens; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the cost to summarize the call. + */ + @JsonProperty("summary") + public Optional getSummary() { + return summary; + } + + /** + * @return This is the number of prompt tokens used to summarize the call. + */ + @JsonProperty("summaryPromptTokens") + public Optional getSummaryPromptTokens() { + return summaryPromptTokens; + } + + /** + * @return This is the number of completion tokens used to summarize the call. + */ + @JsonProperty("summaryCompletionTokens") + public Optional getSummaryCompletionTokens() { + return summaryCompletionTokens; + } + + /** + * @return This is the cost to extract structured data from the call. + */ + @JsonProperty("structuredData") + public Optional getStructuredData() { + return structuredData; + } + + /** + * @return This is the number of prompt tokens used to extract structured data from the call. + */ + @JsonProperty("structuredDataPromptTokens") + public Optional getStructuredDataPromptTokens() { + return structuredDataPromptTokens; + } + + /** + * @return This is the number of completion tokens used to extract structured data from the call. + */ + @JsonProperty("structuredDataCompletionTokens") + public Optional getStructuredDataCompletionTokens() { + return structuredDataCompletionTokens; + } + + /** + * @return This is the cost to evaluate if the call was successful. + */ + @JsonProperty("successEvaluation") + public Optional getSuccessEvaluation() { + return successEvaluation; + } + + /** + * @return This is the number of prompt tokens used to evaluate if the call was successful. + */ + @JsonProperty("successEvaluationPromptTokens") + public Optional getSuccessEvaluationPromptTokens() { + return successEvaluationPromptTokens; + } + + /** + * @return This is the number of completion tokens used to evaluate if the call was successful. + */ + @JsonProperty("successEvaluationCompletionTokens") + public Optional getSuccessEvaluationCompletionTokens() { + return successEvaluationCompletionTokens; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnalysisCostBreakdown && equalTo((AnalysisCostBreakdown) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AnalysisCostBreakdown other) { + return summary.equals(other.summary) + && summaryPromptTokens.equals(other.summaryPromptTokens) + && summaryCompletionTokens.equals(other.summaryCompletionTokens) + && structuredData.equals(other.structuredData) + && structuredDataPromptTokens.equals(other.structuredDataPromptTokens) + && structuredDataCompletionTokens.equals(other.structuredDataCompletionTokens) + && successEvaluation.equals(other.successEvaluation) + && successEvaluationPromptTokens.equals(other.successEvaluationPromptTokens) + && successEvaluationCompletionTokens.equals(other.successEvaluationCompletionTokens); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.summary, + this.summaryPromptTokens, + this.summaryCompletionTokens, + this.structuredData, + this.structuredDataPromptTokens, + this.structuredDataCompletionTokens, + this.successEvaluation, + this.successEvaluationPromptTokens, + this.successEvaluationCompletionTokens); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional summary = Optional.empty(); + + private Optional summaryPromptTokens = Optional.empty(); + + private Optional summaryCompletionTokens = Optional.empty(); + + private Optional structuredData = Optional.empty(); + + private Optional structuredDataPromptTokens = Optional.empty(); + + private Optional structuredDataCompletionTokens = Optional.empty(); + + private Optional successEvaluation = Optional.empty(); + + private Optional successEvaluationPromptTokens = Optional.empty(); + + private Optional successEvaluationCompletionTokens = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AnalysisCostBreakdown other) { + summary(other.getSummary()); + summaryPromptTokens(other.getSummaryPromptTokens()); + summaryCompletionTokens(other.getSummaryCompletionTokens()); + structuredData(other.getStructuredData()); + structuredDataPromptTokens(other.getStructuredDataPromptTokens()); + structuredDataCompletionTokens(other.getStructuredDataCompletionTokens()); + successEvaluation(other.getSuccessEvaluation()); + successEvaluationPromptTokens(other.getSuccessEvaluationPromptTokens()); + successEvaluationCompletionTokens(other.getSuccessEvaluationCompletionTokens()); + return this; + } + + @JsonSetter(value = "summary", nulls = Nulls.SKIP) + public Builder summary(Optional summary) { + this.summary = summary; + return this; + } + + public Builder summary(Double summary) { + this.summary = Optional.ofNullable(summary); + return this; + } + + @JsonSetter(value = "summaryPromptTokens", nulls = Nulls.SKIP) + public Builder summaryPromptTokens(Optional summaryPromptTokens) { + this.summaryPromptTokens = summaryPromptTokens; + return this; + } + + public Builder summaryPromptTokens(Double summaryPromptTokens) { + this.summaryPromptTokens = Optional.ofNullable(summaryPromptTokens); + return this; + } + + @JsonSetter(value = "summaryCompletionTokens", nulls = Nulls.SKIP) + public Builder summaryCompletionTokens(Optional summaryCompletionTokens) { + this.summaryCompletionTokens = summaryCompletionTokens; + return this; + } + + public Builder summaryCompletionTokens(Double summaryCompletionTokens) { + this.summaryCompletionTokens = Optional.ofNullable(summaryCompletionTokens); + return this; + } + + @JsonSetter(value = "structuredData", nulls = Nulls.SKIP) + public Builder structuredData(Optional structuredData) { + this.structuredData = structuredData; + return this; + } + + public Builder structuredData(Double structuredData) { + this.structuredData = Optional.ofNullable(structuredData); + return this; + } + + @JsonSetter(value = "structuredDataPromptTokens", nulls = Nulls.SKIP) + public Builder structuredDataPromptTokens(Optional structuredDataPromptTokens) { + this.structuredDataPromptTokens = structuredDataPromptTokens; + return this; + } + + public Builder structuredDataPromptTokens(Double structuredDataPromptTokens) { + this.structuredDataPromptTokens = Optional.ofNullable(structuredDataPromptTokens); + return this; + } + + @JsonSetter(value = "structuredDataCompletionTokens", nulls = Nulls.SKIP) + public Builder structuredDataCompletionTokens(Optional structuredDataCompletionTokens) { + this.structuredDataCompletionTokens = structuredDataCompletionTokens; + return this; + } + + public Builder structuredDataCompletionTokens(Double structuredDataCompletionTokens) { + this.structuredDataCompletionTokens = Optional.ofNullable(structuredDataCompletionTokens); + return this; + } + + @JsonSetter(value = "successEvaluation", nulls = Nulls.SKIP) + public Builder successEvaluation(Optional successEvaluation) { + this.successEvaluation = successEvaluation; + return this; + } + + public Builder successEvaluation(Double successEvaluation) { + this.successEvaluation = Optional.ofNullable(successEvaluation); + return this; + } + + @JsonSetter(value = "successEvaluationPromptTokens", nulls = Nulls.SKIP) + public Builder successEvaluationPromptTokens(Optional successEvaluationPromptTokens) { + this.successEvaluationPromptTokens = successEvaluationPromptTokens; + return this; + } + + public Builder successEvaluationPromptTokens(Double successEvaluationPromptTokens) { + this.successEvaluationPromptTokens = Optional.ofNullable(successEvaluationPromptTokens); + return this; + } + + @JsonSetter(value = "successEvaluationCompletionTokens", nulls = Nulls.SKIP) + public Builder successEvaluationCompletionTokens(Optional successEvaluationCompletionTokens) { + this.successEvaluationCompletionTokens = successEvaluationCompletionTokens; + return this; + } + + public Builder successEvaluationCompletionTokens(Double successEvaluationCompletionTokens) { + this.successEvaluationCompletionTokens = Optional.ofNullable(successEvaluationCompletionTokens); + return this; + } + + public AnalysisCostBreakdown build() { + return new AnalysisCostBreakdown( + summary, + summaryPromptTokens, + summaryCompletionTokens, + structuredData, + structuredDataPromptTokens, + structuredDataCompletionTokens, + successEvaluation, + successEvaluationPromptTokens, + successEvaluationCompletionTokens, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AnalysisPlan.java b/src/main/java/com/vapi/api/types/AnalysisPlan.java new file mode 100644 index 0000000..40eec0b --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnalysisPlan.java @@ -0,0 +1,154 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AnalysisPlan.Builder.class) +public final class AnalysisPlan { + private final Optional summaryPlan; + + private final Optional structuredDataPlan; + + private final Optional successEvaluationPlan; + + private final Map additionalProperties; + + private AnalysisPlan( + Optional summaryPlan, + Optional structuredDataPlan, + Optional successEvaluationPlan, + Map additionalProperties) { + this.summaryPlan = summaryPlan; + this.structuredDataPlan = structuredDataPlan; + this.successEvaluationPlan = successEvaluationPlan; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the plan for generating the summary of the call. This outputs to call.analysis.summary. + */ + @JsonProperty("summaryPlan") + public Optional getSummaryPlan() { + return summaryPlan; + } + + /** + * @return This is the plan for generating the structured data from the call. This outputs to call.analysis.structuredData. + */ + @JsonProperty("structuredDataPlan") + public Optional getStructuredDataPlan() { + return structuredDataPlan; + } + + /** + * @return This is the plan for generating the success evaluation of the call. This outputs to call.analysis.successEvaluation. + */ + @JsonProperty("successEvaluationPlan") + public Optional getSuccessEvaluationPlan() { + return successEvaluationPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnalysisPlan && equalTo((AnalysisPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AnalysisPlan other) { + return summaryPlan.equals(other.summaryPlan) + && structuredDataPlan.equals(other.structuredDataPlan) + && successEvaluationPlan.equals(other.successEvaluationPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.summaryPlan, this.structuredDataPlan, this.successEvaluationPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional summaryPlan = Optional.empty(); + + private Optional structuredDataPlan = Optional.empty(); + + private Optional successEvaluationPlan = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AnalysisPlan other) { + summaryPlan(other.getSummaryPlan()); + structuredDataPlan(other.getStructuredDataPlan()); + successEvaluationPlan(other.getSuccessEvaluationPlan()); + return this; + } + + @JsonSetter(value = "summaryPlan", nulls = Nulls.SKIP) + public Builder summaryPlan(Optional summaryPlan) { + this.summaryPlan = summaryPlan; + return this; + } + + public Builder summaryPlan(SummaryPlan summaryPlan) { + this.summaryPlan = Optional.ofNullable(summaryPlan); + return this; + } + + @JsonSetter(value = "structuredDataPlan", nulls = Nulls.SKIP) + public Builder structuredDataPlan(Optional structuredDataPlan) { + this.structuredDataPlan = structuredDataPlan; + return this; + } + + public Builder structuredDataPlan(StructuredDataPlan structuredDataPlan) { + this.structuredDataPlan = Optional.ofNullable(structuredDataPlan); + return this; + } + + @JsonSetter(value = "successEvaluationPlan", nulls = Nulls.SKIP) + public Builder successEvaluationPlan(Optional successEvaluationPlan) { + this.successEvaluationPlan = successEvaluationPlan; + return this; + } + + public Builder successEvaluationPlan(SuccessEvaluationPlan successEvaluationPlan) { + this.successEvaluationPlan = Optional.ofNullable(successEvaluationPlan); + return this; + } + + public AnalysisPlan build() { + return new AnalysisPlan(summaryPlan, structuredDataPlan, successEvaluationPlan, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AnalyticsOperation.java b/src/main/java/com/vapi/api/types/AnalyticsOperation.java new file mode 100644 index 0000000..b37f76b --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnalyticsOperation.java @@ -0,0 +1,179 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AnalyticsOperation.Builder.class) +public final class AnalyticsOperation { + private final AnalyticsOperationOperation operation; + + private final AnalyticsOperationColumn column; + + private final Optional alias; + + private final Map additionalProperties; + + private AnalyticsOperation( + AnalyticsOperationOperation operation, + AnalyticsOperationColumn column, + Optional alias, + Map additionalProperties) { + this.operation = operation; + this.column = column; + this.alias = alias; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the aggregation operation you want to perform. + */ + @JsonProperty("operation") + public AnalyticsOperationOperation getOperation() { + return operation; + } + + /** + * @return This is the columns you want to perform the aggregation operation on. + */ + @JsonProperty("column") + public AnalyticsOperationColumn getColumn() { + return column; + } + + /** + * @return This is the alias for column name returned. Defaults to ${operation}${column}. + */ + @JsonProperty("alias") + public Optional getAlias() { + return alias; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnalyticsOperation && equalTo((AnalyticsOperation) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AnalyticsOperation other) { + return operation.equals(other.operation) && column.equals(other.column) && alias.equals(other.alias); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.operation, this.column, this.alias); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static OperationStage builder() { + return new Builder(); + } + + public interface OperationStage { + ColumnStage operation(@NotNull AnalyticsOperationOperation operation); + + Builder from(AnalyticsOperation other); + } + + public interface ColumnStage { + _FinalStage column(@NotNull AnalyticsOperationColumn column); + } + + public interface _FinalStage { + AnalyticsOperation build(); + + _FinalStage alias(Optional alias); + + _FinalStage alias(String alias); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements OperationStage, ColumnStage, _FinalStage { + private AnalyticsOperationOperation operation; + + private AnalyticsOperationColumn column; + + private Optional alias = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AnalyticsOperation other) { + operation(other.getOperation()); + column(other.getColumn()); + alias(other.getAlias()); + return this; + } + + /** + *

This is the aggregation operation you want to perform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("operation") + public ColumnStage operation(@NotNull AnalyticsOperationOperation operation) { + this.operation = Objects.requireNonNull(operation, "operation must not be null"); + return this; + } + + /** + *

This is the columns you want to perform the aggregation operation on.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("column") + public _FinalStage column(@NotNull AnalyticsOperationColumn column) { + this.column = Objects.requireNonNull(column, "column must not be null"); + return this; + } + + /** + *

This is the alias for column name returned. Defaults to ${operation}${column}.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage alias(String alias) { + this.alias = Optional.ofNullable(alias); + return this; + } + + @java.lang.Override + @JsonSetter(value = "alias", nulls = Nulls.SKIP) + public _FinalStage alias(Optional alias) { + this.alias = alias; + return this; + } + + @java.lang.Override + public AnalyticsOperation build() { + return new AnalyticsOperation(operation, column, alias, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AnalyticsOperationColumn.java b/src/main/java/com/vapi/api/types/AnalyticsOperationColumn.java new file mode 100644 index 0000000..61b90b7 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnalyticsOperationColumn.java @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AnalyticsOperationColumn { + ID("id"), + + COST("cost"), + + COST_BREAKDOWN_LLM("costBreakdown.llm"), + + COST_BREAKDOWN_STT("costBreakdown.stt"), + + COST_BREAKDOWN_TTS("costBreakdown.tts"), + + COST_BREAKDOWN_VAPI("costBreakdown.vapi"), + + COST_BREAKDOWN_TTS_CHARACTERS("costBreakdown.ttsCharacters"), + + COST_BREAKDOWN_LLM_PROMPT_TOKENS("costBreakdown.llmPromptTokens"), + + COST_BREAKDOWN_LLM_COMPLETION_TOKENS("costBreakdown.llmCompletionTokens"), + + DURATION("duration"); + + private final String value; + + AnalyticsOperationColumn(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/AnalyticsOperationOperation.java b/src/main/java/com/vapi/api/types/AnalyticsOperationOperation.java new file mode 100644 index 0000000..6766c90 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnalyticsOperationOperation.java @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AnalyticsOperationOperation { + SUM("sum"), + + AVG("avg"), + + COUNT("count"), + + MIN("min"), + + MAX("max"); + + private final String value; + + AnalyticsOperationOperation(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/AnalyticsQuery.java b/src/main/java/com/vapi/api/types/AnalyticsQuery.java new file mode 100644 index 0000000..785f341 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnalyticsQuery.java @@ -0,0 +1,247 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AnalyticsQuery.Builder.class) +public final class AnalyticsQuery { + private final Optional> groupBy; + + private final String name; + + private final Optional timeRange; + + private final List operations; + + private final Map additionalProperties; + + private AnalyticsQuery( + Optional> groupBy, + String name, + Optional timeRange, + List operations, + Map additionalProperties) { + this.groupBy = groupBy; + this.name = name; + this.timeRange = timeRange; + this.operations = operations; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the table you want to query. + */ + @JsonProperty("table") + public String getTable() { + return "call"; + } + + /** + * @return This is the list of columns you want to group by. + */ + @JsonProperty("groupBy") + public Optional> getGroupBy() { + return groupBy; + } + + /** + * @return This is the name of the query. This will be used to identify the query in the response. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return This is the time range for the query. + */ + @JsonProperty("timeRange") + public Optional getTimeRange() { + return timeRange; + } + + /** + * @return This is the list of operations you want to perform. + */ + @JsonProperty("operations") + public List getOperations() { + return operations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnalyticsQuery && equalTo((AnalyticsQuery) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AnalyticsQuery other) { + return groupBy.equals(other.groupBy) + && name.equals(other.name) + && timeRange.equals(other.timeRange) + && operations.equals(other.operations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.groupBy, this.name, this.timeRange, this.operations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + + Builder from(AnalyticsQuery other); + } + + public interface _FinalStage { + AnalyticsQuery build(); + + _FinalStage groupBy(Optional> groupBy); + + _FinalStage groupBy(List groupBy); + + _FinalStage timeRange(Optional timeRange); + + _FinalStage timeRange(TimeRange timeRange); + + _FinalStage operations(List operations); + + _FinalStage addOperations(AnalyticsOperation operations); + + _FinalStage addAllOperations(List operations); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + private List operations = new ArrayList<>(); + + private Optional timeRange = Optional.empty(); + + private Optional> groupBy = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AnalyticsQuery other) { + groupBy(other.getGroupBy()); + name(other.getName()); + timeRange(other.getTimeRange()); + operations(other.getOperations()); + return this; + } + + /** + *

This is the name of the query. This will be used to identify the query in the response.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

This is the list of operations you want to perform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllOperations(List operations) { + this.operations.addAll(operations); + return this; + } + + /** + *

This is the list of operations you want to perform.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addOperations(AnalyticsOperation operations) { + this.operations.add(operations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "operations", nulls = Nulls.SKIP) + public _FinalStage operations(List operations) { + this.operations.clear(); + this.operations.addAll(operations); + return this; + } + + /** + *

This is the time range for the query.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timeRange(TimeRange timeRange) { + this.timeRange = Optional.ofNullable(timeRange); + return this; + } + + @java.lang.Override + @JsonSetter(value = "timeRange", nulls = Nulls.SKIP) + public _FinalStage timeRange(Optional timeRange) { + this.timeRange = timeRange; + return this; + } + + /** + *

This is the list of columns you want to group by.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage groupBy(List groupBy) { + this.groupBy = Optional.ofNullable(groupBy); + return this; + } + + @java.lang.Override + @JsonSetter(value = "groupBy", nulls = Nulls.SKIP) + public _FinalStage groupBy(Optional> groupBy) { + this.groupBy = groupBy; + return this; + } + + @java.lang.Override + public AnalyticsQuery build() { + return new AnalyticsQuery(groupBy, name, timeRange, operations, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AnalyticsQueryGroupByItem.java b/src/main/java/com/vapi/api/types/AnalyticsQueryGroupByItem.java new file mode 100644 index 0000000..947ee84 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnalyticsQueryGroupByItem.java @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AnalyticsQueryGroupByItem { + TYPE("type"), + + ASSISTANT_ID("assistantId"), + + ENDED_REASON("endedReason"), + + ANALYSIS_SUCCESS_EVALUATION("analysis.successEvaluation"), + + STATUS("status"); + + private final String value; + + AnalyticsQueryGroupByItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/AnalyticsQueryResult.java b/src/main/java/com/vapi/api/types/AnalyticsQueryResult.java new file mode 100644 index 0000000..5f1c2a3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnalyticsQueryResult.java @@ -0,0 +1,211 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AnalyticsQueryResult.Builder.class) +public final class AnalyticsQueryResult { + private final String name; + + private final TimeRange timeRange; + + private final List> result; + + private final Map additionalProperties; + + private AnalyticsQueryResult( + String name, + TimeRange timeRange, + List> result, + Map additionalProperties) { + this.name = name; + this.timeRange = timeRange; + this.result = result; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the unique key for the query. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return This is the time range for the query. + */ + @JsonProperty("timeRange") + public TimeRange getTimeRange() { + return timeRange; + } + + /** + * @return This is the result of the query, a list of unique groups with result of their aggregations. + *

Example: + * "result": [ + * { "date": "2023-01-01", "assistantId": "123", "endedReason": "customer-ended-call", "sumDuration": 120, "avgCost": 10.5 }, + * { "date": "2023-01-02", "assistantId": "123", "endedReason": "customer-did-not-give-microphone-permission", "sumDuration": 0, "avgCost": 0 }, + * // Additional results + * ]

+ */ + @JsonProperty("result") + public List> getResult() { + return result; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnalyticsQueryResult && equalTo((AnalyticsQueryResult) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AnalyticsQueryResult other) { + return name.equals(other.name) && timeRange.equals(other.timeRange) && result.equals(other.result); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.timeRange, this.result); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + TimeRangeStage name(@NotNull String name); + + Builder from(AnalyticsQueryResult other); + } + + public interface TimeRangeStage { + _FinalStage timeRange(@NotNull TimeRange timeRange); + } + + public interface _FinalStage { + AnalyticsQueryResult build(); + + _FinalStage result(List> result); + + _FinalStage addResult(Map result); + + _FinalStage addAllResult(List> result); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, TimeRangeStage, _FinalStage { + private String name; + + private TimeRange timeRange; + + private List> result = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AnalyticsQueryResult other) { + name(other.getName()); + timeRange(other.getTimeRange()); + result(other.getResult()); + return this; + } + + /** + *

This is the unique key for the query.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public TimeRangeStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

This is the time range for the query.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("timeRange") + public _FinalStage timeRange(@NotNull TimeRange timeRange) { + this.timeRange = Objects.requireNonNull(timeRange, "timeRange must not be null"); + return this; + } + + /** + *

This is the result of the query, a list of unique groups with result of their aggregations.

+ *

Example: + * "result": [ + * { "date": "2023-01-01", "assistantId": "123", "endedReason": "customer-ended-call", "sumDuration": 120, "avgCost": 10.5 }, + * { "date": "2023-01-02", "assistantId": "123", "endedReason": "customer-did-not-give-microphone-permission", "sumDuration": 0, "avgCost": 0 }, + * // Additional results + * ]

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllResult(List> result) { + this.result.addAll(result); + return this; + } + + /** + *

This is the result of the query, a list of unique groups with result of their aggregations.

+ *

Example: + * "result": [ + * { "date": "2023-01-01", "assistantId": "123", "endedReason": "customer-ended-call", "sumDuration": 120, "avgCost": 10.5 }, + * { "date": "2023-01-02", "assistantId": "123", "endedReason": "customer-did-not-give-microphone-permission", "sumDuration": 0, "avgCost": 0 }, + * // Additional results + * ]

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addResult(Map result) { + this.result.add(result); + return this; + } + + @java.lang.Override + @JsonSetter(value = "result", nulls = Nulls.SKIP) + public _FinalStage result(List> result) { + this.result.clear(); + this.result.addAll(result); + return this; + } + + @java.lang.Override + public AnalyticsQueryResult build() { + return new AnalyticsQueryResult(name, timeRange, result, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AnthropicCredential.java b/src/main/java/com/vapi/api/types/AnthropicCredential.java new file mode 100644 index 0000000..c184235 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnthropicCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AnthropicCredential.Builder.class) +public final class AnthropicCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private AnthropicCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "anthropic"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnthropicCredential && equalTo((AnthropicCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AnthropicCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(AnthropicCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + AnthropicCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AnthropicCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public AnthropicCredential build() { + return new AnthropicCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AnthropicModel.java b/src/main/java/com/vapi/api/types/AnthropicModel.java new file mode 100644 index 0000000..f2e4298 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnthropicModel.java @@ -0,0 +1,441 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AnthropicModel.Builder.class) +public final class AnthropicModel { + private final Optional> messages; + + private final Optional> tools; + + private final Optional> toolIds; + + private final AnthropicModelModel model; + + private final Optional temperature; + + private final Optional knowledgeBase; + + private final Optional maxTokens; + + private final Optional emotionRecognitionEnabled; + + private final Optional numFastTurns; + + private final Map additionalProperties; + + private AnthropicModel( + Optional> messages, + Optional> tools, + Optional> toolIds, + AnthropicModelModel model, + Optional temperature, + Optional knowledgeBase, + Optional maxTokens, + Optional emotionRecognitionEnabled, + Optional numFastTurns, + Map additionalProperties) { + this.messages = messages; + this.tools = tools; + this.toolIds = toolIds; + this.model = model; + this.temperature = temperature; + this.knowledgeBase = knowledgeBase; + this.maxTokens = maxTokens; + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + this.numFastTurns = numFastTurns; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the starting state for the conversation. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return These are the tools that the assistant can use during the call. To use existing tools, use toolIds. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("tools") + public Optional> getTools() { + return tools; + } + + /** + * @return These are the tools that the assistant can use during the call. To use transient tools, use tools. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("toolIds") + public Optional> getToolIds() { + return toolIds; + } + + /** + * @return This is the Anthropic/Claude models that will be used. + */ + @JsonProperty("model") + public AnthropicModelModel getModel() { + return model; + } + + /** + * @return This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + */ + @JsonProperty("temperature") + public Optional getTemperature() { + return temperature; + } + + /** + * @return These are the options for the knowledge base. + */ + @JsonProperty("knowledgeBase") + public Optional getKnowledgeBase() { + return knowledgeBase; + } + + /** + * @return This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. + */ + @JsonProperty("maxTokens") + public Optional getMaxTokens() { + return maxTokens; + } + + /** + * @return This determines whether we detect user's emotion while they speak and send it as an additional info to model. + *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ */ + @JsonProperty("emotionRecognitionEnabled") + public Optional getEmotionRecognitionEnabled() { + return emotionRecognitionEnabled; + } + + /** + * @return This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai. + *

Default is 0.

+ *

@default 0

+ */ + @JsonProperty("numFastTurns") + public Optional getNumFastTurns() { + return numFastTurns; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnthropicModel && equalTo((AnthropicModel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AnthropicModel other) { + return messages.equals(other.messages) + && tools.equals(other.tools) + && toolIds.equals(other.toolIds) + && model.equals(other.model) + && temperature.equals(other.temperature) + && knowledgeBase.equals(other.knowledgeBase) + && maxTokens.equals(other.maxTokens) + && emotionRecognitionEnabled.equals(other.emotionRecognitionEnabled) + && numFastTurns.equals(other.numFastTurns); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.messages, + this.tools, + this.toolIds, + this.model, + this.temperature, + this.knowledgeBase, + this.maxTokens, + this.emotionRecognitionEnabled, + this.numFastTurns); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + _FinalStage model(@NotNull AnthropicModelModel model); + + Builder from(AnthropicModel other); + } + + public interface _FinalStage { + AnthropicModel build(); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage tools(Optional> tools); + + _FinalStage tools(List tools); + + _FinalStage toolIds(Optional> toolIds); + + _FinalStage toolIds(List toolIds); + + _FinalStage temperature(Optional temperature); + + _FinalStage temperature(Double temperature); + + _FinalStage knowledgeBase(Optional knowledgeBase); + + _FinalStage knowledgeBase(KnowledgeBase knowledgeBase); + + _FinalStage maxTokens(Optional maxTokens); + + _FinalStage maxTokens(Double maxTokens); + + _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled); + + _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled); + + _FinalStage numFastTurns(Optional numFastTurns); + + _FinalStage numFastTurns(Double numFastTurns); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, _FinalStage { + private AnthropicModelModel model; + + private Optional numFastTurns = Optional.empty(); + + private Optional emotionRecognitionEnabled = Optional.empty(); + + private Optional maxTokens = Optional.empty(); + + private Optional knowledgeBase = Optional.empty(); + + private Optional temperature = Optional.empty(); + + private Optional> toolIds = Optional.empty(); + + private Optional> tools = Optional.empty(); + + private Optional> messages = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AnthropicModel other) { + messages(other.getMessages()); + tools(other.getTools()); + toolIds(other.getToolIds()); + model(other.getModel()); + temperature(other.getTemperature()); + knowledgeBase(other.getKnowledgeBase()); + maxTokens(other.getMaxTokens()); + emotionRecognitionEnabled(other.getEmotionRecognitionEnabled()); + numFastTurns(other.getNumFastTurns()); + return this; + } + + /** + *

This is the Anthropic/Claude models that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("model") + public _FinalStage model(@NotNull AnthropicModelModel model) { + this.model = Objects.requireNonNull(model, "model must not be null"); + return this; + } + + /** + *

This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai.

+ *

Default is 0.

+ *

@default 0

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numFastTurns(Double numFastTurns) { + this.numFastTurns = Optional.ofNullable(numFastTurns); + return this; + } + + @java.lang.Override + @JsonSetter(value = "numFastTurns", nulls = Nulls.SKIP) + public _FinalStage numFastTurns(Optional numFastTurns) { + this.numFastTurns = numFastTurns; + return this; + } + + /** + *

This determines whether we detect user's emotion while they speak and send it as an additional info to model.

+ *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = Optional.ofNullable(emotionRecognitionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "emotionRecognitionEnabled", nulls = Nulls.SKIP) + public _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + return this; + } + + /** + *

This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxTokens(Double maxTokens) { + this.maxTokens = Optional.ofNullable(maxTokens); + return this; + } + + @java.lang.Override + @JsonSetter(value = "maxTokens", nulls = Nulls.SKIP) + public _FinalStage maxTokens(Optional maxTokens) { + this.maxTokens = maxTokens; + return this; + } + + /** + *

These are the options for the knowledge base.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage knowledgeBase(KnowledgeBase knowledgeBase) { + this.knowledgeBase = Optional.ofNullable(knowledgeBase); + return this; + } + + @java.lang.Override + @JsonSetter(value = "knowledgeBase", nulls = Nulls.SKIP) + public _FinalStage knowledgeBase(Optional knowledgeBase) { + this.knowledgeBase = knowledgeBase; + return this; + } + + /** + *

This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage temperature(Double temperature) { + this.temperature = Optional.ofNullable(temperature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "temperature", nulls = Nulls.SKIP) + public _FinalStage temperature(Optional temperature) { + this.temperature = temperature; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use transient tools, use tools.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toolIds(List toolIds) { + this.toolIds = Optional.ofNullable(toolIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "toolIds", nulls = Nulls.SKIP) + public _FinalStage toolIds(Optional> toolIds) { + this.toolIds = toolIds; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use existing tools, use toolIds.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tools(List tools) { + this.tools = Optional.ofNullable(tools); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tools", nulls = Nulls.SKIP) + public _FinalStage tools(Optional> tools) { + this.tools = tools; + return this; + } + + /** + *

This is the starting state for the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + @java.lang.Override + public AnthropicModel build() { + return new AnthropicModel( + messages, + tools, + toolIds, + model, + temperature, + knowledgeBase, + maxTokens, + emotionRecognitionEnabled, + numFastTurns, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AnthropicModelModel.java b/src/main/java/com/vapi/api/types/AnthropicModelModel.java new file mode 100644 index 0000000..cddb17e --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnthropicModelModel.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AnthropicModelModel { + CLAUDE_3_OPUS_20240229("claude-3-opus-20240229"), + + CLAUDE_3_SONNET_20240229("claude-3-sonnet-20240229"), + + CLAUDE_3_HAIKU_20240307("claude-3-haiku-20240307"), + + CLAUDE_35_SONNET_20240620("claude-3-5-sonnet-20240620"); + + private final String value; + + AnthropicModelModel(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/AnthropicModelToolsItem.java b/src/main/java/com/vapi/api/types/AnthropicModelToolsItem.java new file mode 100644 index 0000000..fd55312 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnthropicModelToolsItem.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class AnthropicModelToolsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private AnthropicModelToolsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static AnthropicModelToolsItem dtmf(CreateDtmfToolDto value) { + return new AnthropicModelToolsItem(new DtmfValue(value)); + } + + public static AnthropicModelToolsItem endCall(CreateEndCallToolDto value) { + return new AnthropicModelToolsItem(new EndCallValue(value)); + } + + public static AnthropicModelToolsItem voicemail(CreateVoicemailToolDto value) { + return new AnthropicModelToolsItem(new VoicemailValue(value)); + } + + public static AnthropicModelToolsItem function(CreateFunctionToolDto value) { + return new AnthropicModelToolsItem(new FunctionValue(value)); + } + + public static AnthropicModelToolsItem ghl(CreateGhlToolDto value) { + return new AnthropicModelToolsItem(new GhlValue(value)); + } + + public static AnthropicModelToolsItem make(CreateMakeToolDto value) { + return new AnthropicModelToolsItem(new MakeValue(value)); + } + + public static AnthropicModelToolsItem transferCall(CreateTransferCallToolDto value) { + return new AnthropicModelToolsItem(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AnthropicModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AnthropicModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AnthropicModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AnthropicModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AnthropicModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AnthropicModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AnthropicModelToolsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "AnthropicModelToolsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/AnyscaleCredential.java b/src/main/java/com/vapi/api/types/AnyscaleCredential.java new file mode 100644 index 0000000..09ff28f --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnyscaleCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AnyscaleCredential.Builder.class) +public final class AnyscaleCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private AnyscaleCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "anyscale"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnyscaleCredential && equalTo((AnyscaleCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AnyscaleCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(AnyscaleCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + AnyscaleCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AnyscaleCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public AnyscaleCredential build() { + return new AnyscaleCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AnyscaleModel.java b/src/main/java/com/vapi/api/types/AnyscaleModel.java new file mode 100644 index 0000000..ddcfcd5 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnyscaleModel.java @@ -0,0 +1,441 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AnyscaleModel.Builder.class) +public final class AnyscaleModel { + private final Optional> messages; + + private final Optional> tools; + + private final Optional> toolIds; + + private final String model; + + private final Optional temperature; + + private final Optional knowledgeBase; + + private final Optional maxTokens; + + private final Optional emotionRecognitionEnabled; + + private final Optional numFastTurns; + + private final Map additionalProperties; + + private AnyscaleModel( + Optional> messages, + Optional> tools, + Optional> toolIds, + String model, + Optional temperature, + Optional knowledgeBase, + Optional maxTokens, + Optional emotionRecognitionEnabled, + Optional numFastTurns, + Map additionalProperties) { + this.messages = messages; + this.tools = tools; + this.toolIds = toolIds; + this.model = model; + this.temperature = temperature; + this.knowledgeBase = knowledgeBase; + this.maxTokens = maxTokens; + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + this.numFastTurns = numFastTurns; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the starting state for the conversation. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return These are the tools that the assistant can use during the call. To use existing tools, use toolIds. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("tools") + public Optional> getTools() { + return tools; + } + + /** + * @return These are the tools that the assistant can use during the call. To use transient tools, use tools. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("toolIds") + public Optional> getToolIds() { + return toolIds; + } + + /** + * @return This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + */ + @JsonProperty("model") + public String getModel() { + return model; + } + + /** + * @return This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + */ + @JsonProperty("temperature") + public Optional getTemperature() { + return temperature; + } + + /** + * @return These are the options for the knowledge base. + */ + @JsonProperty("knowledgeBase") + public Optional getKnowledgeBase() { + return knowledgeBase; + } + + /** + * @return This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. + */ + @JsonProperty("maxTokens") + public Optional getMaxTokens() { + return maxTokens; + } + + /** + * @return This determines whether we detect user's emotion while they speak and send it as an additional info to model. + *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ */ + @JsonProperty("emotionRecognitionEnabled") + public Optional getEmotionRecognitionEnabled() { + return emotionRecognitionEnabled; + } + + /** + * @return This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai. + *

Default is 0.

+ *

@default 0

+ */ + @JsonProperty("numFastTurns") + public Optional getNumFastTurns() { + return numFastTurns; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnyscaleModel && equalTo((AnyscaleModel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AnyscaleModel other) { + return messages.equals(other.messages) + && tools.equals(other.tools) + && toolIds.equals(other.toolIds) + && model.equals(other.model) + && temperature.equals(other.temperature) + && knowledgeBase.equals(other.knowledgeBase) + && maxTokens.equals(other.maxTokens) + && emotionRecognitionEnabled.equals(other.emotionRecognitionEnabled) + && numFastTurns.equals(other.numFastTurns); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.messages, + this.tools, + this.toolIds, + this.model, + this.temperature, + this.knowledgeBase, + this.maxTokens, + this.emotionRecognitionEnabled, + this.numFastTurns); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + _FinalStage model(@NotNull String model); + + Builder from(AnyscaleModel other); + } + + public interface _FinalStage { + AnyscaleModel build(); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage tools(Optional> tools); + + _FinalStage tools(List tools); + + _FinalStage toolIds(Optional> toolIds); + + _FinalStage toolIds(List toolIds); + + _FinalStage temperature(Optional temperature); + + _FinalStage temperature(Double temperature); + + _FinalStage knowledgeBase(Optional knowledgeBase); + + _FinalStage knowledgeBase(KnowledgeBase knowledgeBase); + + _FinalStage maxTokens(Optional maxTokens); + + _FinalStage maxTokens(Double maxTokens); + + _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled); + + _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled); + + _FinalStage numFastTurns(Optional numFastTurns); + + _FinalStage numFastTurns(Double numFastTurns); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, _FinalStage { + private String model; + + private Optional numFastTurns = Optional.empty(); + + private Optional emotionRecognitionEnabled = Optional.empty(); + + private Optional maxTokens = Optional.empty(); + + private Optional knowledgeBase = Optional.empty(); + + private Optional temperature = Optional.empty(); + + private Optional> toolIds = Optional.empty(); + + private Optional> tools = Optional.empty(); + + private Optional> messages = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AnyscaleModel other) { + messages(other.getMessages()); + tools(other.getTools()); + toolIds(other.getToolIds()); + model(other.getModel()); + temperature(other.getTemperature()); + knowledgeBase(other.getKnowledgeBase()); + maxTokens(other.getMaxTokens()); + emotionRecognitionEnabled(other.getEmotionRecognitionEnabled()); + numFastTurns(other.getNumFastTurns()); + return this; + } + + /** + *

This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("model") + public _FinalStage model(@NotNull String model) { + this.model = Objects.requireNonNull(model, "model must not be null"); + return this; + } + + /** + *

This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai.

+ *

Default is 0.

+ *

@default 0

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numFastTurns(Double numFastTurns) { + this.numFastTurns = Optional.ofNullable(numFastTurns); + return this; + } + + @java.lang.Override + @JsonSetter(value = "numFastTurns", nulls = Nulls.SKIP) + public _FinalStage numFastTurns(Optional numFastTurns) { + this.numFastTurns = numFastTurns; + return this; + } + + /** + *

This determines whether we detect user's emotion while they speak and send it as an additional info to model.

+ *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = Optional.ofNullable(emotionRecognitionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "emotionRecognitionEnabled", nulls = Nulls.SKIP) + public _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + return this; + } + + /** + *

This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxTokens(Double maxTokens) { + this.maxTokens = Optional.ofNullable(maxTokens); + return this; + } + + @java.lang.Override + @JsonSetter(value = "maxTokens", nulls = Nulls.SKIP) + public _FinalStage maxTokens(Optional maxTokens) { + this.maxTokens = maxTokens; + return this; + } + + /** + *

These are the options for the knowledge base.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage knowledgeBase(KnowledgeBase knowledgeBase) { + this.knowledgeBase = Optional.ofNullable(knowledgeBase); + return this; + } + + @java.lang.Override + @JsonSetter(value = "knowledgeBase", nulls = Nulls.SKIP) + public _FinalStage knowledgeBase(Optional knowledgeBase) { + this.knowledgeBase = knowledgeBase; + return this; + } + + /** + *

This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage temperature(Double temperature) { + this.temperature = Optional.ofNullable(temperature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "temperature", nulls = Nulls.SKIP) + public _FinalStage temperature(Optional temperature) { + this.temperature = temperature; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use transient tools, use tools.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toolIds(List toolIds) { + this.toolIds = Optional.ofNullable(toolIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "toolIds", nulls = Nulls.SKIP) + public _FinalStage toolIds(Optional> toolIds) { + this.toolIds = toolIds; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use existing tools, use toolIds.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tools(List tools) { + this.tools = Optional.ofNullable(tools); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tools", nulls = Nulls.SKIP) + public _FinalStage tools(Optional> tools) { + this.tools = tools; + return this; + } + + /** + *

This is the starting state for the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + @java.lang.Override + public AnyscaleModel build() { + return new AnyscaleModel( + messages, + tools, + toolIds, + model, + temperature, + knowledgeBase, + maxTokens, + emotionRecognitionEnabled, + numFastTurns, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AnyscaleModelToolsItem.java b/src/main/java/com/vapi/api/types/AnyscaleModelToolsItem.java new file mode 100644 index 0000000..595501d --- /dev/null +++ b/src/main/java/com/vapi/api/types/AnyscaleModelToolsItem.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class AnyscaleModelToolsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private AnyscaleModelToolsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static AnyscaleModelToolsItem dtmf(CreateDtmfToolDto value) { + return new AnyscaleModelToolsItem(new DtmfValue(value)); + } + + public static AnyscaleModelToolsItem endCall(CreateEndCallToolDto value) { + return new AnyscaleModelToolsItem(new EndCallValue(value)); + } + + public static AnyscaleModelToolsItem voicemail(CreateVoicemailToolDto value) { + return new AnyscaleModelToolsItem(new VoicemailValue(value)); + } + + public static AnyscaleModelToolsItem function(CreateFunctionToolDto value) { + return new AnyscaleModelToolsItem(new FunctionValue(value)); + } + + public static AnyscaleModelToolsItem ghl(CreateGhlToolDto value) { + return new AnyscaleModelToolsItem(new GhlValue(value)); + } + + public static AnyscaleModelToolsItem make(CreateMakeToolDto value) { + return new AnyscaleModelToolsItem(new MakeValue(value)); + } + + public static AnyscaleModelToolsItem transferCall(CreateTransferCallToolDto value) { + return new AnyscaleModelToolsItem(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AnyscaleModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AnyscaleModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AnyscaleModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AnyscaleModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AnyscaleModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AnyscaleModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AnyscaleModelToolsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "AnyscaleModelToolsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/Artifact.java b/src/main/java/com/vapi/api/types/Artifact.java new file mode 100644 index 0000000..c670744 --- /dev/null +++ b/src/main/java/com/vapi/api/types/Artifact.java @@ -0,0 +1,278 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Artifact.Builder.class) +public final class Artifact { + private final Optional> messages; + + private final Optional> messagesOpenAiFormatted; + + private final Optional recordingUrl; + + private final Optional stereoRecordingUrl; + + private final Optional videoRecordingUrl; + + private final Optional videoRecordingStartDelaySeconds; + + private final Optional transcript; + + private final Map additionalProperties; + + private Artifact( + Optional> messages, + Optional> messagesOpenAiFormatted, + Optional recordingUrl, + Optional stereoRecordingUrl, + Optional videoRecordingUrl, + Optional videoRecordingStartDelaySeconds, + Optional transcript, + Map additionalProperties) { + this.messages = messages; + this.messagesOpenAiFormatted = messagesOpenAiFormatted; + this.recordingUrl = recordingUrl; + this.stereoRecordingUrl = stereoRecordingUrl; + this.videoRecordingUrl = videoRecordingUrl; + this.videoRecordingStartDelaySeconds = videoRecordingStartDelaySeconds; + this.transcript = transcript; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the messages that were spoken during the call. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return These are the messages that were spoken during the call, formatted for OpenAI. + */ + @JsonProperty("messagesOpenAIFormatted") + public Optional> getMessagesOpenAiFormatted() { + return messagesOpenAiFormatted; + } + + /** + * @return This is the recording url for the call. To enable, set assistant.artifactPlan.recordingEnabled. + */ + @JsonProperty("recordingUrl") + public Optional getRecordingUrl() { + return recordingUrl; + } + + /** + * @return This is the stereo recording url for the call. To enable, set assistant.artifactPlan.recordingEnabled. + */ + @JsonProperty("stereoRecordingUrl") + public Optional getStereoRecordingUrl() { + return stereoRecordingUrl; + } + + /** + * @return This is video recording url for the call. To enable, set assistant.artifactPlan.videoRecordingEnabled. + */ + @JsonProperty("videoRecordingUrl") + public Optional getVideoRecordingUrl() { + return videoRecordingUrl; + } + + /** + * @return This is video recording start delay in ms. To enable, set assistant.artifactPlan.videoRecordingEnabled. This can be used to align the playback of the recording with artifact.messages timestamps. + */ + @JsonProperty("videoRecordingStartDelaySeconds") + public Optional getVideoRecordingStartDelaySeconds() { + return videoRecordingStartDelaySeconds; + } + + /** + * @return This is the transcript of the call. This is derived from artifact.messages but provided for convenience. + */ + @JsonProperty("transcript") + public Optional getTranscript() { + return transcript; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Artifact && equalTo((Artifact) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Artifact other) { + return messages.equals(other.messages) + && messagesOpenAiFormatted.equals(other.messagesOpenAiFormatted) + && recordingUrl.equals(other.recordingUrl) + && stereoRecordingUrl.equals(other.stereoRecordingUrl) + && videoRecordingUrl.equals(other.videoRecordingUrl) + && videoRecordingStartDelaySeconds.equals(other.videoRecordingStartDelaySeconds) + && transcript.equals(other.transcript); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.messages, + this.messagesOpenAiFormatted, + this.recordingUrl, + this.stereoRecordingUrl, + this.videoRecordingUrl, + this.videoRecordingStartDelaySeconds, + this.transcript); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> messages = Optional.empty(); + + private Optional> messagesOpenAiFormatted = Optional.empty(); + + private Optional recordingUrl = Optional.empty(); + + private Optional stereoRecordingUrl = Optional.empty(); + + private Optional videoRecordingUrl = Optional.empty(); + + private Optional videoRecordingStartDelaySeconds = Optional.empty(); + + private Optional transcript = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(Artifact other) { + messages(other.getMessages()); + messagesOpenAiFormatted(other.getMessagesOpenAiFormatted()); + recordingUrl(other.getRecordingUrl()); + stereoRecordingUrl(other.getStereoRecordingUrl()); + videoRecordingUrl(other.getVideoRecordingUrl()); + videoRecordingStartDelaySeconds(other.getVideoRecordingStartDelaySeconds()); + transcript(other.getTranscript()); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "messagesOpenAIFormatted", nulls = Nulls.SKIP) + public Builder messagesOpenAiFormatted(Optional> messagesOpenAiFormatted) { + this.messagesOpenAiFormatted = messagesOpenAiFormatted; + return this; + } + + public Builder messagesOpenAiFormatted(List messagesOpenAiFormatted) { + this.messagesOpenAiFormatted = Optional.ofNullable(messagesOpenAiFormatted); + return this; + } + + @JsonSetter(value = "recordingUrl", nulls = Nulls.SKIP) + public Builder recordingUrl(Optional recordingUrl) { + this.recordingUrl = recordingUrl; + return this; + } + + public Builder recordingUrl(String recordingUrl) { + this.recordingUrl = Optional.ofNullable(recordingUrl); + return this; + } + + @JsonSetter(value = "stereoRecordingUrl", nulls = Nulls.SKIP) + public Builder stereoRecordingUrl(Optional stereoRecordingUrl) { + this.stereoRecordingUrl = stereoRecordingUrl; + return this; + } + + public Builder stereoRecordingUrl(String stereoRecordingUrl) { + this.stereoRecordingUrl = Optional.ofNullable(stereoRecordingUrl); + return this; + } + + @JsonSetter(value = "videoRecordingUrl", nulls = Nulls.SKIP) + public Builder videoRecordingUrl(Optional videoRecordingUrl) { + this.videoRecordingUrl = videoRecordingUrl; + return this; + } + + public Builder videoRecordingUrl(String videoRecordingUrl) { + this.videoRecordingUrl = Optional.ofNullable(videoRecordingUrl); + return this; + } + + @JsonSetter(value = "videoRecordingStartDelaySeconds", nulls = Nulls.SKIP) + public Builder videoRecordingStartDelaySeconds(Optional videoRecordingStartDelaySeconds) { + this.videoRecordingStartDelaySeconds = videoRecordingStartDelaySeconds; + return this; + } + + public Builder videoRecordingStartDelaySeconds(Double videoRecordingStartDelaySeconds) { + this.videoRecordingStartDelaySeconds = Optional.ofNullable(videoRecordingStartDelaySeconds); + return this; + } + + @JsonSetter(value = "transcript", nulls = Nulls.SKIP) + public Builder transcript(Optional transcript) { + this.transcript = transcript; + return this; + } + + public Builder transcript(String transcript) { + this.transcript = Optional.ofNullable(transcript); + return this; + } + + public Artifact build() { + return new Artifact( + messages, + messagesOpenAiFormatted, + recordingUrl, + stereoRecordingUrl, + videoRecordingUrl, + videoRecordingStartDelaySeconds, + transcript, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ArtifactMessagesItem.java b/src/main/java/com/vapi/api/types/ArtifactMessagesItem.java new file mode 100644 index 0000000..35294fb --- /dev/null +++ b/src/main/java/com/vapi/api/types/ArtifactMessagesItem.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.vapi.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = ArtifactMessagesItem.Deserializer.class) +public final class ArtifactMessagesItem { + private final Object value; + + private final int type; + + private ArtifactMessagesItem(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((UserMessage) this.value); + } else if (this.type == 1) { + return visitor.visit((SystemMessage) this.value); + } else if (this.type == 2) { + return visitor.visit((BotMessage) this.value); + } else if (this.type == 3) { + return visitor.visit((ToolCallMessage) this.value); + } else if (this.type == 4) { + return visitor.visit((ToolCallResultMessage) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ArtifactMessagesItem && equalTo((ArtifactMessagesItem) other); + } + + private boolean equalTo(ArtifactMessagesItem other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static ArtifactMessagesItem of(UserMessage value) { + return new ArtifactMessagesItem(value, 0); + } + + public static ArtifactMessagesItem of(SystemMessage value) { + return new ArtifactMessagesItem(value, 1); + } + + public static ArtifactMessagesItem of(BotMessage value) { + return new ArtifactMessagesItem(value, 2); + } + + public static ArtifactMessagesItem of(ToolCallMessage value) { + return new ArtifactMessagesItem(value, 3); + } + + public static ArtifactMessagesItem of(ToolCallResultMessage value) { + return new ArtifactMessagesItem(value, 4); + } + + public interface Visitor { + T visit(UserMessage value); + + T visit(SystemMessage value); + + T visit(BotMessage value); + + T visit(ToolCallMessage value); + + T visit(ToolCallResultMessage value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(ArtifactMessagesItem.class); + } + + @java.lang.Override + public ArtifactMessagesItem deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, UserMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, SystemMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, BotMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ToolCallMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ToolCallResultMessage.class)); + } catch (IllegalArgumentException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ArtifactPlan.java b/src/main/java/com/vapi/api/types/ArtifactPlan.java new file mode 100644 index 0000000..407f1cf --- /dev/null +++ b/src/main/java/com/vapi/api/types/ArtifactPlan.java @@ -0,0 +1,198 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ArtifactPlan.Builder.class) +public final class ArtifactPlan { + private final Optional recordingEnabled; + + private final Optional videoRecordingEnabled; + + private final Optional transcriptPlan; + + private final Optional recordingPath; + + private final Map additionalProperties; + + private ArtifactPlan( + Optional recordingEnabled, + Optional videoRecordingEnabled, + Optional transcriptPlan, + Optional recordingPath, + Map additionalProperties) { + this.recordingEnabled = recordingEnabled; + this.videoRecordingEnabled = videoRecordingEnabled; + this.transcriptPlan = transcriptPlan; + this.recordingPath = recordingPath; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines whether assistant's calls are recorded. Defaults to true. + *

Usage:

+ *
    + *
  • If you don't want to record the calls, set this to false.
  • + *
  • If you want to record the calls when assistant.hipaaEnabled, explicity set this to true and make sure to provide S3 or GCP credentials on the Provider Credentials page in the Dashboard.
  • + *
+ *

You can find the recording at call.artifact.recordingUrl and call.artifact.stereoRecordingUrl after the call is ended.

+ *

@default true

+ */ + @JsonProperty("recordingEnabled") + public Optional getRecordingEnabled() { + return recordingEnabled; + } + + /** + * @return This determines whether the video is recorded during the call. Defaults to false. Only relevant for webCall type. + *

You can find the video recording at call.artifact.videoRecordingUrl after the call is ended.

+ *

@default false

+ */ + @JsonProperty("videoRecordingEnabled") + public Optional getVideoRecordingEnabled() { + return videoRecordingEnabled; + } + + /** + * @return This is the plan for call.artifact.transcript. To disable, set transcriptPlan.enabled to false. + */ + @JsonProperty("transcriptPlan") + public Optional getTranscriptPlan() { + return transcriptPlan; + } + + /** + * @return This is the path where the recording will be uploaded. This is only used if you have provided S3 or GCP credentials on the Provider Credentials page in the Dashboard. + *

If credential.s3PathPrefix or credential.bucketPlan.path is set, this will append to it.

+ *

Usage:

+ *
    + *
  • If you want to upload the recording to a specific path, set this to the path. Example: /my-assistant-recordings.
  • + *
  • If you want to upload the recording to the root of the bucket, set this to /.
  • + *
+ *

@default '/'

+ */ + @JsonProperty("recordingPath") + public Optional getRecordingPath() { + return recordingPath; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ArtifactPlan && equalTo((ArtifactPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ArtifactPlan other) { + return recordingEnabled.equals(other.recordingEnabled) + && videoRecordingEnabled.equals(other.videoRecordingEnabled) + && transcriptPlan.equals(other.transcriptPlan) + && recordingPath.equals(other.recordingPath); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.recordingEnabled, this.videoRecordingEnabled, this.transcriptPlan, this.recordingPath); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional recordingEnabled = Optional.empty(); + + private Optional videoRecordingEnabled = Optional.empty(); + + private Optional transcriptPlan = Optional.empty(); + + private Optional recordingPath = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ArtifactPlan other) { + recordingEnabled(other.getRecordingEnabled()); + videoRecordingEnabled(other.getVideoRecordingEnabled()); + transcriptPlan(other.getTranscriptPlan()); + recordingPath(other.getRecordingPath()); + return this; + } + + @JsonSetter(value = "recordingEnabled", nulls = Nulls.SKIP) + public Builder recordingEnabled(Optional recordingEnabled) { + this.recordingEnabled = recordingEnabled; + return this; + } + + public Builder recordingEnabled(Boolean recordingEnabled) { + this.recordingEnabled = Optional.ofNullable(recordingEnabled); + return this; + } + + @JsonSetter(value = "videoRecordingEnabled", nulls = Nulls.SKIP) + public Builder videoRecordingEnabled(Optional videoRecordingEnabled) { + this.videoRecordingEnabled = videoRecordingEnabled; + return this; + } + + public Builder videoRecordingEnabled(Boolean videoRecordingEnabled) { + this.videoRecordingEnabled = Optional.ofNullable(videoRecordingEnabled); + return this; + } + + @JsonSetter(value = "transcriptPlan", nulls = Nulls.SKIP) + public Builder transcriptPlan(Optional transcriptPlan) { + this.transcriptPlan = transcriptPlan; + return this; + } + + public Builder transcriptPlan(TranscriptPlan transcriptPlan) { + this.transcriptPlan = Optional.ofNullable(transcriptPlan); + return this; + } + + @JsonSetter(value = "recordingPath", nulls = Nulls.SKIP) + public Builder recordingPath(Optional recordingPath) { + this.recordingPath = recordingPath; + return this; + } + + public Builder recordingPath(String recordingPath) { + this.recordingPath = Optional.ofNullable(recordingPath); + return this; + } + + public ArtifactPlan build() { + return new ArtifactPlan( + recordingEnabled, videoRecordingEnabled, transcriptPlan, recordingPath, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AssignmentMutation.java b/src/main/java/com/vapi/api/types/AssignmentMutation.java new file mode 100644 index 0000000..a761711 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssignmentMutation.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AssignmentMutation.Builder.class) +public final class AssignmentMutation { + private final Optional> conditions; + + private final String variable; + + private final String value; + + private final Map additionalProperties; + + private AssignmentMutation( + Optional> conditions, + String variable, + String value, + Map additionalProperties) { + this.conditions = conditions; + this.variable = variable; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is an optional array of conditions that must be met for this mutation to be triggered. + */ + @JsonProperty("conditions") + public Optional> getConditions() { + return conditions; + } + + /** + * @return This mutation assigns a new value to an existing or new variable. + */ + @JsonProperty("type") + public String getType() { + return "assignment"; + } + + /** + * @return This is the variable to assign a new value to. + *

You can reference any variable in the context of the current block execution (step):

+ *
    + *
  • "output.your-property-name" for current step's output
  • + *
  • "your-step-name.output.your-property-name" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "your-block-name.output.your-property-name" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "global.your-property-name" for the global context
  • + *
+ *

This needs to be the key path of the variable. If you use {{}}, it'll dereference that to the value of the variable before assignment. This can be useful if the path is dynamic. Example:

+ *
    + *
  • "global.{{my-tool-call-step.output.my-key-name}}"
  • + *
+ *

You can also string interpolate multiple variables to get the key name:

+ *
    + *
  • "global.{{my-tool-call-step.output.my-key-name-suffix}}-{{my-tool-call-step.output.my-key-name}}"
  • + *
+ *

The path to the new variable is created if it doesn't exist. Example:

+ *
    + *
  • "global.this-does-not-exist.neither-does-this" will create this-does-not-exist object with neither-does-this as a key
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow.
  4. + *
+ */ + @JsonProperty("variable") + public String getVariable() { + return variable; + } + + /** + * @return The value to assign to the variable. + *

You can reference any variable in the context of the current block execution (step):

+ *
    + *
  • "{{output.your-property-name}}" for current step's output
  • + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

Or, you can use a constant:

+ *
    + *
  • "1"
  • + *
  • "text"
  • + *
  • "true"
  • + *
  • "false"
  • + *
+ *

Or, you can mix and match with string interpolation:

+ *
    + *
  • "{{your-property-name}}-{{input.your-property-name-2}}-1"
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow.
  4. + *
+ */ + @JsonProperty("value") + public String getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AssignmentMutation && equalTo((AssignmentMutation) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AssignmentMutation other) { + return conditions.equals(other.conditions) && variable.equals(other.variable) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.conditions, this.variable, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VariableStage builder() { + return new Builder(); + } + + public interface VariableStage { + ValueStage variable(@NotNull String variable); + + Builder from(AssignmentMutation other); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + } + + public interface _FinalStage { + AssignmentMutation build(); + + _FinalStage conditions(Optional> conditions); + + _FinalStage conditions(List conditions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VariableStage, ValueStage, _FinalStage { + private String variable; + + private String value; + + private Optional> conditions = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AssignmentMutation other) { + conditions(other.getConditions()); + variable(other.getVariable()); + value(other.getValue()); + return this; + } + + /** + *

This is the variable to assign a new value to.

+ *

You can reference any variable in the context of the current block execution (step):

+ *
    + *
  • "output.your-property-name" for current step's output
  • + *
  • "your-step-name.output.your-property-name" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "your-block-name.output.your-property-name" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "global.your-property-name" for the global context
  • + *
+ *

This needs to be the key path of the variable. If you use {{}}, it'll dereference that to the value of the variable before assignment. This can be useful if the path is dynamic. Example:

+ *
    + *
  • "global.{{my-tool-call-step.output.my-key-name}}"
  • + *
+ *

You can also string interpolate multiple variables to get the key name:

+ *
    + *
  • "global.{{my-tool-call-step.output.my-key-name-suffix}}-{{my-tool-call-step.output.my-key-name}}"
  • + *
+ *

The path to the new variable is created if it doesn't exist. Example:

+ *
    + *
  • "global.this-does-not-exist.neither-does-this" will create this-does-not-exist object with neither-does-this as a key
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow.
  4. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("variable") + public ValueStage variable(@NotNull String variable) { + this.variable = Objects.requireNonNull(variable, "variable must not be null"); + return this; + } + + /** + *

The value to assign to the variable.

+ *

You can reference any variable in the context of the current block execution (step):

+ *
    + *
  • "{{output.your-property-name}}" for current step's output
  • + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

Or, you can use a constant:

+ *
    + *
  • "1"
  • + *
  • "text"
  • + *
  • "true"
  • + *
  • "false"
  • + *
+ *

Or, you can mix and match with string interpolation:

+ *
    + *
  • "{{your-property-name}}-{{input.your-property-name-2}}-1"
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow.
  4. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + /** + *

This is an optional array of conditions that must be met for this mutation to be triggered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage conditions(List conditions) { + this.conditions = Optional.ofNullable(conditions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "conditions", nulls = Nulls.SKIP) + public _FinalStage conditions(Optional> conditions) { + this.conditions = conditions; + return this; + } + + @java.lang.Override + public AssignmentMutation build() { + return new AssignmentMutation(conditions, variable, value, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AssignmentMutationConditionsItem.java b/src/main/java/com/vapi/api/types/AssignmentMutationConditionsItem.java new file mode 100644 index 0000000..69ac2f3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssignmentMutationConditionsItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class AssignmentMutationConditionsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private AssignmentMutationConditionsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static AssignmentMutationConditionsItem modelBased(ModelBasedCondition value) { + return new AssignmentMutationConditionsItem(new ModelBasedValue(value)); + } + + public static AssignmentMutationConditionsItem ruleBased(RuleBasedCondition value) { + return new AssignmentMutationConditionsItem(new RuleBasedValue(value)); + } + + public boolean isModelBased() { + return value instanceof ModelBasedValue; + } + + public boolean isRuleBased() { + return value instanceof RuleBasedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getModelBased() { + if (isModelBased()) { + return Optional.of(((ModelBasedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRuleBased() { + if (isRuleBased()) { + return Optional.of(((RuleBasedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitModelBased(ModelBasedCondition modelBased); + + T visitRuleBased(RuleBasedCondition ruleBased); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(ModelBasedValue.class), @JsonSubTypes.Type(RuleBasedValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("model-based") + private static final class ModelBasedValue implements Value { + @JsonUnwrapped + private ModelBasedCondition value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ModelBasedValue() {} + + private ModelBasedValue(ModelBasedCondition value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitModelBased(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ModelBasedValue && equalTo((ModelBasedValue) other); + } + + private boolean equalTo(ModelBasedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssignmentMutationConditionsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("rule-based") + private static final class RuleBasedValue implements Value { + @JsonUnwrapped + private RuleBasedCondition value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RuleBasedValue() {} + + private RuleBasedValue(RuleBasedCondition value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRuleBased(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RuleBasedValue && equalTo((RuleBasedValue) other); + } + + private boolean equalTo(RuleBasedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssignmentMutationConditionsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "AssignmentMutationConditionsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/Assistant.java b/src/main/java/com/vapi/api/types/Assistant.java new file mode 100644 index 0000000..dabb520 --- /dev/null +++ b/src/main/java/com/vapi/api/types/Assistant.java @@ -0,0 +1,1480 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Assistant.Builder.class) +public final class Assistant { + private final Optional transcriber; + + private final Optional model; + + private final Optional voice; + + private final Optional firstMessageMode; + + private final Optional hipaaEnabled; + + private final Optional> clientMessages; + + private final Optional> serverMessages; + + private final Optional silenceTimeoutSeconds; + + private final Optional maxDurationSeconds; + + private final Optional backgroundSound; + + private final Optional backchannelingEnabled; + + private final Optional backgroundDenoisingEnabled; + + private final Optional modelOutputInMessagesEnabled; + + private final Optional> transportConfigurations; + + private final Optional name; + + private final Optional firstMessage; + + private final Optional voicemailDetection; + + private final Optional voicemailMessage; + + private final Optional endCallMessage; + + private final Optional> endCallPhrases; + + private final Optional> metadata; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Optional analysisPlan; + + private final Optional artifactPlan; + + private final Optional messagePlan; + + private final Optional startSpeakingPlan; + + private final Optional stopSpeakingPlan; + + private final Optional monitorPlan; + + private final Optional> credentialIds; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private Assistant( + Optional transcriber, + Optional model, + Optional voice, + Optional firstMessageMode, + Optional hipaaEnabled, + Optional> clientMessages, + Optional> serverMessages, + Optional silenceTimeoutSeconds, + Optional maxDurationSeconds, + Optional backgroundSound, + Optional backchannelingEnabled, + Optional backgroundDenoisingEnabled, + Optional modelOutputInMessagesEnabled, + Optional> transportConfigurations, + Optional name, + Optional firstMessage, + Optional voicemailDetection, + Optional voicemailMessage, + Optional endCallMessage, + Optional> endCallPhrases, + Optional> metadata, + Optional serverUrl, + Optional serverUrlSecret, + Optional analysisPlan, + Optional artifactPlan, + Optional messagePlan, + Optional startSpeakingPlan, + Optional stopSpeakingPlan, + Optional monitorPlan, + Optional> credentialIds, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.transcriber = transcriber; + this.model = model; + this.voice = voice; + this.firstMessageMode = firstMessageMode; + this.hipaaEnabled = hipaaEnabled; + this.clientMessages = clientMessages; + this.serverMessages = serverMessages; + this.silenceTimeoutSeconds = silenceTimeoutSeconds; + this.maxDurationSeconds = maxDurationSeconds; + this.backgroundSound = backgroundSound; + this.backchannelingEnabled = backchannelingEnabled; + this.backgroundDenoisingEnabled = backgroundDenoisingEnabled; + this.modelOutputInMessagesEnabled = modelOutputInMessagesEnabled; + this.transportConfigurations = transportConfigurations; + this.name = name; + this.firstMessage = firstMessage; + this.voicemailDetection = voicemailDetection; + this.voicemailMessage = voicemailMessage; + this.endCallMessage = endCallMessage; + this.endCallPhrases = endCallPhrases; + this.metadata = metadata; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.analysisPlan = analysisPlan; + this.artifactPlan = artifactPlan; + this.messagePlan = messagePlan; + this.startSpeakingPlan = startSpeakingPlan; + this.stopSpeakingPlan = stopSpeakingPlan; + this.monitorPlan = monitorPlan; + this.credentialIds = credentialIds; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the options for the assistant's transcriber. + */ + @JsonProperty("transcriber") + public Optional getTranscriber() { + return transcriber; + } + + /** + * @return These are the options for the assistant's LLM. + */ + @JsonProperty("model") + public Optional getModel() { + return model; + } + + /** + * @return These are the options for the assistant's voice. + */ + @JsonProperty("voice") + public Optional getVoice() { + return voice; + } + + /** + * @return This is the mode for the first message. Default is 'assistant-speaks-first'. + *

Use:

+ *
    + *
  • 'assistant-speaks-first' to have the assistant speak first.
  • + *
  • 'assistant-waits-for-user' to have the assistant wait for the user to speak first.
  • + *
  • 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (assistant.model.messages at call start, call.messages at squad transfer points).
  • + *
+ *

@default 'assistant-speaks-first'

+ */ + @JsonProperty("firstMessageMode") + public Optional getFirstMessageMode() { + return firstMessageMode; + } + + /** + * @return When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false. + */ + @JsonProperty("hipaaEnabled") + public Optional getHipaaEnabled() { + return hipaaEnabled; + } + + /** + * @return These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema. + */ + @JsonProperty("clientMessages") + public Optional> getClientMessages() { + return clientMessages; + } + + /** + * @return These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,user-interrupted. You can check the shape of the messages in ServerMessage schema. + */ + @JsonProperty("serverMessages") + public Optional> getServerMessages() { + return serverMessages; + } + + /** + * @return How many seconds of silence to wait before ending the call. Defaults to 30. + *

@default 30

+ */ + @JsonProperty("silenceTimeoutSeconds") + public Optional getSilenceTimeoutSeconds() { + return silenceTimeoutSeconds; + } + + /** + * @return This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended. + *

@default 600 (10 minutes)

+ */ + @JsonProperty("maxDurationSeconds") + public Optional getMaxDurationSeconds() { + return maxDurationSeconds; + } + + /** + * @return This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'. + */ + @JsonProperty("backgroundSound") + public Optional getBackgroundSound() { + return backgroundSound; + } + + /** + * @return This determines whether the model says 'mhmm', 'ahem' etc. while user is speaking. + *

Default false while in beta.

+ *

@default false

+ */ + @JsonProperty("backchannelingEnabled") + public Optional getBackchannelingEnabled() { + return backchannelingEnabled; + } + + /** + * @return This enables filtering of noise and background speech while the user is talking. + *

Default false while in beta.

+ *

@default false

+ */ + @JsonProperty("backgroundDenoisingEnabled") + public Optional getBackgroundDenoisingEnabled() { + return backgroundDenoisingEnabled; + } + + /** + * @return This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech. + *

Default false while in beta.

+ *

@default false

+ */ + @JsonProperty("modelOutputInMessagesEnabled") + public Optional getModelOutputInMessagesEnabled() { + return modelOutputInMessagesEnabled; + } + + /** + * @return These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used. + */ + @JsonProperty("transportConfigurations") + public Optional> getTransportConfigurations() { + return transportConfigurations; + } + + /** + * @return This is the name of the assistant. + *

This is required when you want to transfer between assistants in a call.

+ */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). + *

If unspecified, assistant will wait for user to speak and use the model to respond once they speak.

+ */ + @JsonProperty("firstMessage") + public Optional getFirstMessage() { + return firstMessage; + } + + /** + * @return These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. + * This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached. + * You can use neither of them, one of them, or both of them. By default, Twilio built-in detection is enabled while VoicemailTool is not. + */ + @JsonProperty("voicemailDetection") + public Optional getVoicemailDetection() { + return voicemailDetection; + } + + /** + * @return This is the message that the assistant will say if the call is forwarded to voicemail. + *

If unspecified, it will hang up.

+ */ + @JsonProperty("voicemailMessage") + public Optional getVoicemailMessage() { + return voicemailMessage; + } + + /** + * @return This is the message that the assistant will say if it ends the call. + *

If unspecified, it will hang up without saying anything.

+ */ + @JsonProperty("endCallMessage") + public Optional getEndCallMessage() { + return endCallMessage; + } + + /** + * @return This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive. + */ + @JsonProperty("endCallPhrases") + public Optional> getEndCallPhrases() { + return endCallPhrases; + } + + /** + * @return This is for metadata you want to store on the assistant. + */ + @JsonProperty("metadata") + public Optional> getMetadata() { + return metadata; + } + + /** + * @return This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports. + *

All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + /** + * @return This is the plan for analysis of assistant's calls. Stored in call.analysis. + */ + @JsonProperty("analysisPlan") + public Optional getAnalysisPlan() { + return analysisPlan; + } + + /** + * @return This is the plan for artifacts generated during assistant's calls. Stored in call.artifact. + *

Note: recordingEnabled is currently at the root level. It will be moved to artifactPlan in the future, but will remain backwards compatible.

+ */ + @JsonProperty("artifactPlan") + public Optional getArtifactPlan() { + return artifactPlan; + } + + /** + * @return This is the plan for static predefined messages that can be spoken by the assistant during the call, like idleMessages. + *

Note: firstMessage, voicemailMessage, and endCallMessage are currently at the root level. They will be moved to messagePlan in the future, but will remain backwards compatible.

+ */ + @JsonProperty("messagePlan") + public Optional getMessagePlan() { + return messagePlan; + } + + /** + * @return This is the plan for when the assistant should start talking. + *

You should configure this if you're running into these issues:

+ *
    + *
  • The assistant is too slow to start talking after the customer is done speaking.
  • + *
  • The assistant is too fast to start talking after the customer is done speaking.
  • + *
  • The assistant is so fast that it's actually interrupting the customer.
  • + *
+ */ + @JsonProperty("startSpeakingPlan") + public Optional getStartSpeakingPlan() { + return startSpeakingPlan; + } + + /** + * @return This is the plan for when assistant should stop talking on customer interruption. + *

You should configure this if you're running into these issues:

+ *
    + *
  • The assistant is too slow to recognize customer's interruption.
  • + *
  • The assistant is too fast to recognize customer's interruption.
  • + *
  • The assistant is getting interrupted by phrases that are just acknowledgments.
  • + *
  • The assistant is getting interrupted by background noises.
  • + *
  • The assistant is not properly stopping -- it starts talking right after getting interrupted.
  • + *
+ */ + @JsonProperty("stopSpeakingPlan") + public Optional getStopSpeakingPlan() { + return stopSpeakingPlan; + } + + /** + * @return This is the plan for real-time monitoring of the assistant's calls. + *

Usage:

+ *
    + *
  • To enable live listening of the assistant's calls, set monitorPlan.listenEnabled to true.
  • + *
  • To enable live control of the assistant's calls, set monitorPlan.controlEnabled to true.
  • + *
+ *

Note, serverMessages, clientMessages, serverUrl and serverUrlSecret are currently at the root level but will be moved to monitorPlan in the future. Will remain backwards compatible

+ */ + @JsonProperty("monitorPlan") + public Optional getMonitorPlan() { + return monitorPlan; + } + + /** + * @return These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this. + */ + @JsonProperty("credentialIds") + public Optional> getCredentialIds() { + return credentialIds; + } + + /** + * @return This is the unique identifier for the assistant. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this assistant belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Assistant && equalTo((Assistant) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Assistant other) { + return transcriber.equals(other.transcriber) + && model.equals(other.model) + && voice.equals(other.voice) + && firstMessageMode.equals(other.firstMessageMode) + && hipaaEnabled.equals(other.hipaaEnabled) + && clientMessages.equals(other.clientMessages) + && serverMessages.equals(other.serverMessages) + && silenceTimeoutSeconds.equals(other.silenceTimeoutSeconds) + && maxDurationSeconds.equals(other.maxDurationSeconds) + && backgroundSound.equals(other.backgroundSound) + && backchannelingEnabled.equals(other.backchannelingEnabled) + && backgroundDenoisingEnabled.equals(other.backgroundDenoisingEnabled) + && modelOutputInMessagesEnabled.equals(other.modelOutputInMessagesEnabled) + && transportConfigurations.equals(other.transportConfigurations) + && name.equals(other.name) + && firstMessage.equals(other.firstMessage) + && voicemailDetection.equals(other.voicemailDetection) + && voicemailMessage.equals(other.voicemailMessage) + && endCallMessage.equals(other.endCallMessage) + && endCallPhrases.equals(other.endCallPhrases) + && metadata.equals(other.metadata) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret) + && analysisPlan.equals(other.analysisPlan) + && artifactPlan.equals(other.artifactPlan) + && messagePlan.equals(other.messagePlan) + && startSpeakingPlan.equals(other.startSpeakingPlan) + && stopSpeakingPlan.equals(other.stopSpeakingPlan) + && monitorPlan.equals(other.monitorPlan) + && credentialIds.equals(other.credentialIds) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.transcriber, + this.model, + this.voice, + this.firstMessageMode, + this.hipaaEnabled, + this.clientMessages, + this.serverMessages, + this.silenceTimeoutSeconds, + this.maxDurationSeconds, + this.backgroundSound, + this.backchannelingEnabled, + this.backgroundDenoisingEnabled, + this.modelOutputInMessagesEnabled, + this.transportConfigurations, + this.name, + this.firstMessage, + this.voicemailDetection, + this.voicemailMessage, + this.endCallMessage, + this.endCallPhrases, + this.metadata, + this.serverUrl, + this.serverUrlSecret, + this.analysisPlan, + this.artifactPlan, + this.messagePlan, + this.startSpeakingPlan, + this.stopSpeakingPlan, + this.monitorPlan, + this.credentialIds, + this.id, + this.orgId, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(Assistant other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + Assistant build(); + + _FinalStage transcriber(Optional transcriber); + + _FinalStage transcriber(AssistantTranscriber transcriber); + + _FinalStage model(Optional model); + + _FinalStage model(AssistantModel model); + + _FinalStage voice(Optional voice); + + _FinalStage voice(AssistantVoice voice); + + _FinalStage firstMessageMode(Optional firstMessageMode); + + _FinalStage firstMessageMode(AssistantFirstMessageMode firstMessageMode); + + _FinalStage hipaaEnabled(Optional hipaaEnabled); + + _FinalStage hipaaEnabled(Boolean hipaaEnabled); + + _FinalStage clientMessages(Optional> clientMessages); + + _FinalStage clientMessages(List clientMessages); + + _FinalStage serverMessages(Optional> serverMessages); + + _FinalStage serverMessages(List serverMessages); + + _FinalStage silenceTimeoutSeconds(Optional silenceTimeoutSeconds); + + _FinalStage silenceTimeoutSeconds(Double silenceTimeoutSeconds); + + _FinalStage maxDurationSeconds(Optional maxDurationSeconds); + + _FinalStage maxDurationSeconds(Double maxDurationSeconds); + + _FinalStage backgroundSound(Optional backgroundSound); + + _FinalStage backgroundSound(AssistantBackgroundSound backgroundSound); + + _FinalStage backchannelingEnabled(Optional backchannelingEnabled); + + _FinalStage backchannelingEnabled(Boolean backchannelingEnabled); + + _FinalStage backgroundDenoisingEnabled(Optional backgroundDenoisingEnabled); + + _FinalStage backgroundDenoisingEnabled(Boolean backgroundDenoisingEnabled); + + _FinalStage modelOutputInMessagesEnabled(Optional modelOutputInMessagesEnabled); + + _FinalStage modelOutputInMessagesEnabled(Boolean modelOutputInMessagesEnabled); + + _FinalStage transportConfigurations(Optional> transportConfigurations); + + _FinalStage transportConfigurations(List transportConfigurations); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage firstMessage(Optional firstMessage); + + _FinalStage firstMessage(String firstMessage); + + _FinalStage voicemailDetection(Optional voicemailDetection); + + _FinalStage voicemailDetection(TwilioVoicemailDetection voicemailDetection); + + _FinalStage voicemailMessage(Optional voicemailMessage); + + _FinalStage voicemailMessage(String voicemailMessage); + + _FinalStage endCallMessage(Optional endCallMessage); + + _FinalStage endCallMessage(String endCallMessage); + + _FinalStage endCallPhrases(Optional> endCallPhrases); + + _FinalStage endCallPhrases(List endCallPhrases); + + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + + _FinalStage serverUrl(Optional serverUrl); + + _FinalStage serverUrl(String serverUrl); + + _FinalStage serverUrlSecret(Optional serverUrlSecret); + + _FinalStage serverUrlSecret(String serverUrlSecret); + + _FinalStage analysisPlan(Optional analysisPlan); + + _FinalStage analysisPlan(AnalysisPlan analysisPlan); + + _FinalStage artifactPlan(Optional artifactPlan); + + _FinalStage artifactPlan(ArtifactPlan artifactPlan); + + _FinalStage messagePlan(Optional messagePlan); + + _FinalStage messagePlan(MessagePlan messagePlan); + + _FinalStage startSpeakingPlan(Optional startSpeakingPlan); + + _FinalStage startSpeakingPlan(StartSpeakingPlan startSpeakingPlan); + + _FinalStage stopSpeakingPlan(Optional stopSpeakingPlan); + + _FinalStage stopSpeakingPlan(StopSpeakingPlan stopSpeakingPlan); + + _FinalStage monitorPlan(Optional monitorPlan); + + _FinalStage monitorPlan(MonitorPlan monitorPlan); + + _FinalStage credentialIds(Optional> credentialIds); + + _FinalStage credentialIds(List credentialIds); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional> credentialIds = Optional.empty(); + + private Optional monitorPlan = Optional.empty(); + + private Optional stopSpeakingPlan = Optional.empty(); + + private Optional startSpeakingPlan = Optional.empty(); + + private Optional messagePlan = Optional.empty(); + + private Optional artifactPlan = Optional.empty(); + + private Optional analysisPlan = Optional.empty(); + + private Optional serverUrlSecret = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional> endCallPhrases = Optional.empty(); + + private Optional endCallMessage = Optional.empty(); + + private Optional voicemailMessage = Optional.empty(); + + private Optional voicemailDetection = Optional.empty(); + + private Optional firstMessage = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional> transportConfigurations = Optional.empty(); + + private Optional modelOutputInMessagesEnabled = Optional.empty(); + + private Optional backgroundDenoisingEnabled = Optional.empty(); + + private Optional backchannelingEnabled = Optional.empty(); + + private Optional backgroundSound = Optional.empty(); + + private Optional maxDurationSeconds = Optional.empty(); + + private Optional silenceTimeoutSeconds = Optional.empty(); + + private Optional> serverMessages = Optional.empty(); + + private Optional> clientMessages = Optional.empty(); + + private Optional hipaaEnabled = Optional.empty(); + + private Optional firstMessageMode = Optional.empty(); + + private Optional voice = Optional.empty(); + + private Optional model = Optional.empty(); + + private Optional transcriber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Assistant other) { + transcriber(other.getTranscriber()); + model(other.getModel()); + voice(other.getVoice()); + firstMessageMode(other.getFirstMessageMode()); + hipaaEnabled(other.getHipaaEnabled()); + clientMessages(other.getClientMessages()); + serverMessages(other.getServerMessages()); + silenceTimeoutSeconds(other.getSilenceTimeoutSeconds()); + maxDurationSeconds(other.getMaxDurationSeconds()); + backgroundSound(other.getBackgroundSound()); + backchannelingEnabled(other.getBackchannelingEnabled()); + backgroundDenoisingEnabled(other.getBackgroundDenoisingEnabled()); + modelOutputInMessagesEnabled(other.getModelOutputInMessagesEnabled()); + transportConfigurations(other.getTransportConfigurations()); + name(other.getName()); + firstMessage(other.getFirstMessage()); + voicemailDetection(other.getVoicemailDetection()); + voicemailMessage(other.getVoicemailMessage()); + endCallMessage(other.getEndCallMessage()); + endCallPhrases(other.getEndCallPhrases()); + metadata(other.getMetadata()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + analysisPlan(other.getAnalysisPlan()); + artifactPlan(other.getArtifactPlan()); + messagePlan(other.getMessagePlan()); + startSpeakingPlan(other.getStartSpeakingPlan()); + stopSpeakingPlan(other.getStopSpeakingPlan()); + monitorPlan(other.getMonitorPlan()); + credentialIds(other.getCredentialIds()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is the unique identifier for the assistant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this assistant belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage credentialIds(List credentialIds) { + this.credentialIds = Optional.ofNullable(credentialIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credentialIds", nulls = Nulls.SKIP) + public _FinalStage credentialIds(Optional> credentialIds) { + this.credentialIds = credentialIds; + return this; + } + + /** + *

This is the plan for real-time monitoring of the assistant's calls.

+ *

Usage:

+ *
    + *
  • To enable live listening of the assistant's calls, set monitorPlan.listenEnabled to true.
  • + *
  • To enable live control of the assistant's calls, set monitorPlan.controlEnabled to true.
  • + *
+ *

Note, serverMessages, clientMessages, serverUrl and serverUrlSecret are currently at the root level but will be moved to monitorPlan in the future. Will remain backwards compatible

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage monitorPlan(MonitorPlan monitorPlan) { + this.monitorPlan = Optional.ofNullable(monitorPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monitorPlan", nulls = Nulls.SKIP) + public _FinalStage monitorPlan(Optional monitorPlan) { + this.monitorPlan = monitorPlan; + return this; + } + + /** + *

This is the plan for when assistant should stop talking on customer interruption.

+ *

You should configure this if you're running into these issues:

+ *
    + *
  • The assistant is too slow to recognize customer's interruption.
  • + *
  • The assistant is too fast to recognize customer's interruption.
  • + *
  • The assistant is getting interrupted by phrases that are just acknowledgments.
  • + *
  • The assistant is getting interrupted by background noises.
  • + *
  • The assistant is not properly stopping -- it starts talking right after getting interrupted.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage stopSpeakingPlan(StopSpeakingPlan stopSpeakingPlan) { + this.stopSpeakingPlan = Optional.ofNullable(stopSpeakingPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "stopSpeakingPlan", nulls = Nulls.SKIP) + public _FinalStage stopSpeakingPlan(Optional stopSpeakingPlan) { + this.stopSpeakingPlan = stopSpeakingPlan; + return this; + } + + /** + *

This is the plan for when the assistant should start talking.

+ *

You should configure this if you're running into these issues:

+ *
    + *
  • The assistant is too slow to start talking after the customer is done speaking.
  • + *
  • The assistant is too fast to start talking after the customer is done speaking.
  • + *
  • The assistant is so fast that it's actually interrupting the customer.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startSpeakingPlan(StartSpeakingPlan startSpeakingPlan) { + this.startSpeakingPlan = Optional.ofNullable(startSpeakingPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "startSpeakingPlan", nulls = Nulls.SKIP) + public _FinalStage startSpeakingPlan(Optional startSpeakingPlan) { + this.startSpeakingPlan = startSpeakingPlan; + return this; + } + + /** + *

This is the plan for static predefined messages that can be spoken by the assistant during the call, like idleMessages.

+ *

Note: firstMessage, voicemailMessage, and endCallMessage are currently at the root level. They will be moved to messagePlan in the future, but will remain backwards compatible.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messagePlan(MessagePlan messagePlan) { + this.messagePlan = Optional.ofNullable(messagePlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messagePlan", nulls = Nulls.SKIP) + public _FinalStage messagePlan(Optional messagePlan) { + this.messagePlan = messagePlan; + return this; + } + + /** + *

This is the plan for artifacts generated during assistant's calls. Stored in call.artifact.

+ *

Note: recordingEnabled is currently at the root level. It will be moved to artifactPlan in the future, but will remain backwards compatible.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage artifactPlan(ArtifactPlan artifactPlan) { + this.artifactPlan = Optional.ofNullable(artifactPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "artifactPlan", nulls = Nulls.SKIP) + public _FinalStage artifactPlan(Optional artifactPlan) { + this.artifactPlan = artifactPlan; + return this; + } + + /** + *

This is the plan for analysis of assistant's calls. Stored in call.analysis.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage analysisPlan(AnalysisPlan analysisPlan) { + this.analysisPlan = Optional.ofNullable(analysisPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "analysisPlan", nulls = Nulls.SKIP) + public _FinalStage analysisPlan(Optional analysisPlan) { + this.analysisPlan = analysisPlan; + return this; + } + + /** + *

This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret.

+ *

Same precedence logic as serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public _FinalStage serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + /** + *

This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports.

+ *

All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public _FinalStage serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + /** + *

This is for metadata you want to store on the assistant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + /** + *

This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endCallPhrases(List endCallPhrases) { + this.endCallPhrases = Optional.ofNullable(endCallPhrases); + return this; + } + + @java.lang.Override + @JsonSetter(value = "endCallPhrases", nulls = Nulls.SKIP) + public _FinalStage endCallPhrases(Optional> endCallPhrases) { + this.endCallPhrases = endCallPhrases; + return this; + } + + /** + *

This is the message that the assistant will say if it ends the call.

+ *

If unspecified, it will hang up without saying anything.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endCallMessage(String endCallMessage) { + this.endCallMessage = Optional.ofNullable(endCallMessage); + return this; + } + + @java.lang.Override + @JsonSetter(value = "endCallMessage", nulls = Nulls.SKIP) + public _FinalStage endCallMessage(Optional endCallMessage) { + this.endCallMessage = endCallMessage; + return this; + } + + /** + *

This is the message that the assistant will say if the call is forwarded to voicemail.

+ *

If unspecified, it will hang up.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage voicemailMessage(String voicemailMessage) { + this.voicemailMessage = Optional.ofNullable(voicemailMessage); + return this; + } + + @java.lang.Override + @JsonSetter(value = "voicemailMessage", nulls = Nulls.SKIP) + public _FinalStage voicemailMessage(Optional voicemailMessage) { + this.voicemailMessage = voicemailMessage; + return this; + } + + /** + *

These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. + * This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached. + * You can use neither of them, one of them, or both of them. By default, Twilio built-in detection is enabled while VoicemailTool is not.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage voicemailDetection(TwilioVoicemailDetection voicemailDetection) { + this.voicemailDetection = Optional.ofNullable(voicemailDetection); + return this; + } + + @java.lang.Override + @JsonSetter(value = "voicemailDetection", nulls = Nulls.SKIP) + public _FinalStage voicemailDetection(Optional voicemailDetection) { + this.voicemailDetection = voicemailDetection; + return this; + } + + /** + *

This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.).

+ *

If unspecified, assistant will wait for user to speak and use the model to respond once they speak.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstMessage(String firstMessage) { + this.firstMessage = Optional.ofNullable(firstMessage); + return this; + } + + @java.lang.Override + @JsonSetter(value = "firstMessage", nulls = Nulls.SKIP) + public _FinalStage firstMessage(Optional firstMessage) { + this.firstMessage = firstMessage; + return this; + } + + /** + *

This is the name of the assistant.

+ *

This is required when you want to transfer between assistants in a call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage transportConfigurations(List transportConfigurations) { + this.transportConfigurations = Optional.ofNullable(transportConfigurations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transportConfigurations", nulls = Nulls.SKIP) + public _FinalStage transportConfigurations( + Optional> transportConfigurations) { + this.transportConfigurations = transportConfigurations; + return this; + } + + /** + *

This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech.

+ *

Default false while in beta.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage modelOutputInMessagesEnabled(Boolean modelOutputInMessagesEnabled) { + this.modelOutputInMessagesEnabled = Optional.ofNullable(modelOutputInMessagesEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "modelOutputInMessagesEnabled", nulls = Nulls.SKIP) + public _FinalStage modelOutputInMessagesEnabled(Optional modelOutputInMessagesEnabled) { + this.modelOutputInMessagesEnabled = modelOutputInMessagesEnabled; + return this; + } + + /** + *

This enables filtering of noise and background speech while the user is talking.

+ *

Default false while in beta.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage backgroundDenoisingEnabled(Boolean backgroundDenoisingEnabled) { + this.backgroundDenoisingEnabled = Optional.ofNullable(backgroundDenoisingEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "backgroundDenoisingEnabled", nulls = Nulls.SKIP) + public _FinalStage backgroundDenoisingEnabled(Optional backgroundDenoisingEnabled) { + this.backgroundDenoisingEnabled = backgroundDenoisingEnabled; + return this; + } + + /** + *

This determines whether the model says 'mhmm', 'ahem' etc. while user is speaking.

+ *

Default false while in beta.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage backchannelingEnabled(Boolean backchannelingEnabled) { + this.backchannelingEnabled = Optional.ofNullable(backchannelingEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "backchannelingEnabled", nulls = Nulls.SKIP) + public _FinalStage backchannelingEnabled(Optional backchannelingEnabled) { + this.backchannelingEnabled = backchannelingEnabled; + return this; + } + + /** + *

This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage backgroundSound(AssistantBackgroundSound backgroundSound) { + this.backgroundSound = Optional.ofNullable(backgroundSound); + return this; + } + + @java.lang.Override + @JsonSetter(value = "backgroundSound", nulls = Nulls.SKIP) + public _FinalStage backgroundSound(Optional backgroundSound) { + this.backgroundSound = backgroundSound; + return this; + } + + /** + *

This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended.

+ *

@default 600 (10 minutes)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxDurationSeconds(Double maxDurationSeconds) { + this.maxDurationSeconds = Optional.ofNullable(maxDurationSeconds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "maxDurationSeconds", nulls = Nulls.SKIP) + public _FinalStage maxDurationSeconds(Optional maxDurationSeconds) { + this.maxDurationSeconds = maxDurationSeconds; + return this; + } + + /** + *

How many seconds of silence to wait before ending the call. Defaults to 30.

+ *

@default 30

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage silenceTimeoutSeconds(Double silenceTimeoutSeconds) { + this.silenceTimeoutSeconds = Optional.ofNullable(silenceTimeoutSeconds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "silenceTimeoutSeconds", nulls = Nulls.SKIP) + public _FinalStage silenceTimeoutSeconds(Optional silenceTimeoutSeconds) { + this.silenceTimeoutSeconds = silenceTimeoutSeconds; + return this; + } + + /** + *

These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,user-interrupted. You can check the shape of the messages in ServerMessage schema.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverMessages(List serverMessages) { + this.serverMessages = Optional.ofNullable(serverMessages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverMessages", nulls = Nulls.SKIP) + public _FinalStage serverMessages(Optional> serverMessages) { + this.serverMessages = serverMessages; + return this; + } + + /** + *

These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage clientMessages(List clientMessages) { + this.clientMessages = Optional.ofNullable(clientMessages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "clientMessages", nulls = Nulls.SKIP) + public _FinalStage clientMessages(Optional> clientMessages) { + this.clientMessages = clientMessages; + return this; + } + + /** + *

When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hipaaEnabled(Boolean hipaaEnabled) { + this.hipaaEnabled = Optional.ofNullable(hipaaEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "hipaaEnabled", nulls = Nulls.SKIP) + public _FinalStage hipaaEnabled(Optional hipaaEnabled) { + this.hipaaEnabled = hipaaEnabled; + return this; + } + + /** + *

This is the mode for the first message. Default is 'assistant-speaks-first'.

+ *

Use:

+ *
    + *
  • 'assistant-speaks-first' to have the assistant speak first.
  • + *
  • 'assistant-waits-for-user' to have the assistant wait for the user to speak first.
  • + *
  • 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (assistant.model.messages at call start, call.messages at squad transfer points).
  • + *
+ *

@default 'assistant-speaks-first'

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage firstMessageMode(AssistantFirstMessageMode firstMessageMode) { + this.firstMessageMode = Optional.ofNullable(firstMessageMode); + return this; + } + + @java.lang.Override + @JsonSetter(value = "firstMessageMode", nulls = Nulls.SKIP) + public _FinalStage firstMessageMode(Optional firstMessageMode) { + this.firstMessageMode = firstMessageMode; + return this; + } + + /** + *

These are the options for the assistant's voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage voice(AssistantVoice voice) { + this.voice = Optional.ofNullable(voice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "voice", nulls = Nulls.SKIP) + public _FinalStage voice(Optional voice) { + this.voice = voice; + return this; + } + + /** + *

These are the options for the assistant's LLM.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage model(AssistantModel model) { + this.model = Optional.ofNullable(model); + return this; + } + + @java.lang.Override + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public _FinalStage model(Optional model) { + this.model = model; + return this; + } + + /** + *

These are the options for the assistant's transcriber.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage transcriber(AssistantTranscriber transcriber) { + this.transcriber = Optional.ofNullable(transcriber); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transcriber", nulls = Nulls.SKIP) + public _FinalStage transcriber(Optional transcriber) { + this.transcriber = transcriber; + return this; + } + + @java.lang.Override + public Assistant build() { + return new Assistant( + transcriber, + model, + voice, + firstMessageMode, + hipaaEnabled, + clientMessages, + serverMessages, + silenceTimeoutSeconds, + maxDurationSeconds, + backgroundSound, + backchannelingEnabled, + backgroundDenoisingEnabled, + modelOutputInMessagesEnabled, + transportConfigurations, + name, + firstMessage, + voicemailDetection, + voicemailMessage, + endCallMessage, + endCallPhrases, + metadata, + serverUrl, + serverUrlSecret, + analysisPlan, + artifactPlan, + messagePlan, + startSpeakingPlan, + stopSpeakingPlan, + monitorPlan, + credentialIds, + id, + orgId, + createdAt, + updatedAt, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AssistantBackgroundSound.java b/src/main/java/com/vapi/api/types/AssistantBackgroundSound.java new file mode 100644 index 0000000..3485c33 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssistantBackgroundSound.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AssistantBackgroundSound { + OFF("off"), + + OFFICE("office"); + + private final String value; + + AssistantBackgroundSound(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/AssistantClientMessagesItem.java b/src/main/java/com/vapi/api/types/AssistantClientMessagesItem.java new file mode 100644 index 0000000..a5ff260 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssistantClientMessagesItem.java @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AssistantClientMessagesItem { + CONVERSATION_UPDATE("conversation-update"), + + FUNCTION_CALL("function-call"), + + FUNCTION_CALL_RESULT("function-call-result"), + + HANG("hang"), + + LANGUAGE_CHANGED("language-changed"), + + METADATA("metadata"), + + MODEL_OUTPUT("model-output"), + + SPEECH_UPDATE("speech-update"), + + STATUS_UPDATE("status-update"), + + TRANSCRIPT("transcript"), + + TOOL_CALLS("tool-calls"), + + TOOL_CALLS_RESULT("tool-calls-result"), + + USER_INTERRUPTED("user-interrupted"), + + VOICE_INPUT("voice-input"); + + private final String value; + + AssistantClientMessagesItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/AssistantFirstMessageMode.java b/src/main/java/com/vapi/api/types/AssistantFirstMessageMode.java new file mode 100644 index 0000000..68df312 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssistantFirstMessageMode.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AssistantFirstMessageMode { + ASSISTANT_SPEAKS_FIRST("assistant-speaks-first"), + + ASSISTANT_SPEAKS_FIRST_WITH_MODEL_GENERATED_MESSAGE("assistant-speaks-first-with-model-generated-message"), + + ASSISTANT_WAITS_FOR_USER("assistant-waits-for-user"); + + private final String value; + + AssistantFirstMessageMode(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/AssistantModel.java b/src/main/java/com/vapi/api/types/AssistantModel.java new file mode 100644 index 0000000..612d9b8 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssistantModel.java @@ -0,0 +1,651 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class AssistantModel { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private AssistantModel(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static AssistantModel anyscale(AnyscaleModel value) { + return new AssistantModel(new AnyscaleValue(value)); + } + + public static AssistantModel anthropic(AnthropicModel value) { + return new AssistantModel(new AnthropicValue(value)); + } + + public static AssistantModel customLlm(CustomLlmModel value) { + return new AssistantModel(new CustomLlmValue(value)); + } + + public static AssistantModel deepinfra(DeepInfraModel value) { + return new AssistantModel(new DeepinfraValue(value)); + } + + public static AssistantModel groq(GroqModel value) { + return new AssistantModel(new GroqValue(value)); + } + + public static AssistantModel openai(OpenAiModel value) { + return new AssistantModel(new OpenaiValue(value)); + } + + public static AssistantModel openrouter(OpenRouterModel value) { + return new AssistantModel(new OpenrouterValue(value)); + } + + public static AssistantModel perplexityAi(PerplexityAiModel value) { + return new AssistantModel(new PerplexityAiValue(value)); + } + + public static AssistantModel togetherAi(TogetherAiModel value) { + return new AssistantModel(new TogetherAiValue(value)); + } + + public static AssistantModel vapi(VapiModel value) { + return new AssistantModel(new VapiValue(value)); + } + + public boolean isAnyscale() { + return value instanceof AnyscaleValue; + } + + public boolean isAnthropic() { + return value instanceof AnthropicValue; + } + + public boolean isCustomLlm() { + return value instanceof CustomLlmValue; + } + + public boolean isDeepinfra() { + return value instanceof DeepinfraValue; + } + + public boolean isGroq() { + return value instanceof GroqValue; + } + + public boolean isOpenai() { + return value instanceof OpenaiValue; + } + + public boolean isOpenrouter() { + return value instanceof OpenrouterValue; + } + + public boolean isPerplexityAi() { + return value instanceof PerplexityAiValue; + } + + public boolean isTogetherAi() { + return value instanceof TogetherAiValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAnyscale() { + if (isAnyscale()) { + return Optional.of(((AnyscaleValue) value).value); + } + return Optional.empty(); + } + + public Optional getAnthropic() { + if (isAnthropic()) { + return Optional.of(((AnthropicValue) value).value); + } + return Optional.empty(); + } + + public Optional getCustomLlm() { + if (isCustomLlm()) { + return Optional.of(((CustomLlmValue) value).value); + } + return Optional.empty(); + } + + public Optional getDeepinfra() { + if (isDeepinfra()) { + return Optional.of(((DeepinfraValue) value).value); + } + return Optional.empty(); + } + + public Optional getGroq() { + if (isGroq()) { + return Optional.of(((GroqValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenai() { + if (isOpenai()) { + return Optional.of(((OpenaiValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenrouter() { + if (isOpenrouter()) { + return Optional.of(((OpenrouterValue) value).value); + } + return Optional.empty(); + } + + public Optional getPerplexityAi() { + if (isPerplexityAi()) { + return Optional.of(((PerplexityAiValue) value).value); + } + return Optional.empty(); + } + + public Optional getTogetherAi() { + if (isTogetherAi()) { + return Optional.of(((TogetherAiValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAnyscale(AnyscaleModel anyscale); + + T visitAnthropic(AnthropicModel anthropic); + + T visitCustomLlm(CustomLlmModel customLlm); + + T visitDeepinfra(DeepInfraModel deepinfra); + + T visitGroq(GroqModel groq); + + T visitOpenai(OpenAiModel openai); + + T visitOpenrouter(OpenRouterModel openrouter); + + T visitPerplexityAi(PerplexityAiModel perplexityAi); + + T visitTogetherAi(TogetherAiModel togetherAi); + + T visitVapi(VapiModel vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AnyscaleValue.class), + @JsonSubTypes.Type(AnthropicValue.class), + @JsonSubTypes.Type(CustomLlmValue.class), + @JsonSubTypes.Type(DeepinfraValue.class), + @JsonSubTypes.Type(GroqValue.class), + @JsonSubTypes.Type(OpenaiValue.class), + @JsonSubTypes.Type(OpenrouterValue.class), + @JsonSubTypes.Type(PerplexityAiValue.class), + @JsonSubTypes.Type(TogetherAiValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("anyscale") + private static final class AnyscaleValue implements Value { + @JsonUnwrapped + private AnyscaleModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AnyscaleValue() {} + + private AnyscaleValue(AnyscaleModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAnyscale(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnyscaleValue && equalTo((AnyscaleValue) other); + } + + private boolean equalTo(AnyscaleValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("anthropic") + private static final class AnthropicValue implements Value { + @JsonUnwrapped + private AnthropicModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AnthropicValue() {} + + private AnthropicValue(AnthropicModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAnthropic(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnthropicValue && equalTo((AnthropicValue) other); + } + + private boolean equalTo(AnthropicValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("custom-llm") + private static final class CustomLlmValue implements Value { + @JsonUnwrapped + private CustomLlmModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CustomLlmValue() {} + + private CustomLlmValue(CustomLlmModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCustomLlm(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CustomLlmValue && equalTo((CustomLlmValue) other); + } + + private boolean equalTo(CustomLlmValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("deepinfra") + private static final class DeepinfraValue implements Value { + @JsonUnwrapped + private DeepInfraModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepinfraValue() {} + + private DeepinfraValue(DeepInfraModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDeepinfra(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepinfraValue && equalTo((DeepinfraValue) other); + } + + private boolean equalTo(DeepinfraValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("groq") + private static final class GroqValue implements Value { + @JsonUnwrapped + private GroqModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GroqValue() {} + + private GroqValue(GroqModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGroq(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GroqValue && equalTo((GroqValue) other); + } + + private boolean equalTo(GroqValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("openai") + private static final class OpenaiValue implements Value { + @JsonUnwrapped + private OpenAiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenaiValue() {} + + private OpenaiValue(OpenAiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOpenai(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenaiValue && equalTo((OpenaiValue) other); + } + + private boolean equalTo(OpenaiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("openrouter") + private static final class OpenrouterValue implements Value { + @JsonUnwrapped + private OpenRouterModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenrouterValue() {} + + private OpenrouterValue(OpenRouterModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOpenrouter(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenrouterValue && equalTo((OpenrouterValue) other); + } + + private boolean equalTo(OpenrouterValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("perplexity-ai") + private static final class PerplexityAiValue implements Value { + @JsonUnwrapped + private PerplexityAiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private PerplexityAiValue() {} + + private PerplexityAiValue(PerplexityAiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitPerplexityAi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PerplexityAiValue && equalTo((PerplexityAiValue) other); + } + + private boolean equalTo(PerplexityAiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("together-ai") + private static final class TogetherAiValue implements Value { + @JsonUnwrapped + private TogetherAiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TogetherAiValue() {} + + private TogetherAiValue(TogetherAiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTogetherAi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TogetherAiValue && equalTo((TogetherAiValue) other); + } + + private boolean equalTo(TogetherAiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private VapiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(VapiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantModel{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantModel{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/AssistantOverrides.java b/src/main/java/com/vapi/api/types/AssistantOverrides.java new file mode 100644 index 0000000..d42b813 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssistantOverrides.java @@ -0,0 +1,1020 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AssistantOverrides.Builder.class) +public final class AssistantOverrides { + private final Optional transcriber; + + private final Optional model; + + private final Optional voice; + + private final Optional firstMessageMode; + + private final Optional hipaaEnabled; + + private final Optional> clientMessages; + + private final Optional> serverMessages; + + private final Optional silenceTimeoutSeconds; + + private final Optional maxDurationSeconds; + + private final Optional backgroundSound; + + private final Optional backchannelingEnabled; + + private final Optional backgroundDenoisingEnabled; + + private final Optional modelOutputInMessagesEnabled; + + private final Optional> transportConfigurations; + + private final Optional> variableValues; + + private final Optional name; + + private final Optional firstMessage; + + private final Optional voicemailDetection; + + private final Optional voicemailMessage; + + private final Optional endCallMessage; + + private final Optional> endCallPhrases; + + private final Optional> metadata; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Optional analysisPlan; + + private final Optional artifactPlan; + + private final Optional messagePlan; + + private final Optional startSpeakingPlan; + + private final Optional stopSpeakingPlan; + + private final Optional monitorPlan; + + private final Optional> credentialIds; + + private final Map additionalProperties; + + private AssistantOverrides( + Optional transcriber, + Optional model, + Optional voice, + Optional firstMessageMode, + Optional hipaaEnabled, + Optional> clientMessages, + Optional> serverMessages, + Optional silenceTimeoutSeconds, + Optional maxDurationSeconds, + Optional backgroundSound, + Optional backchannelingEnabled, + Optional backgroundDenoisingEnabled, + Optional modelOutputInMessagesEnabled, + Optional> transportConfigurations, + Optional> variableValues, + Optional name, + Optional firstMessage, + Optional voicemailDetection, + Optional voicemailMessage, + Optional endCallMessage, + Optional> endCallPhrases, + Optional> metadata, + Optional serverUrl, + Optional serverUrlSecret, + Optional analysisPlan, + Optional artifactPlan, + Optional messagePlan, + Optional startSpeakingPlan, + Optional stopSpeakingPlan, + Optional monitorPlan, + Optional> credentialIds, + Map additionalProperties) { + this.transcriber = transcriber; + this.model = model; + this.voice = voice; + this.firstMessageMode = firstMessageMode; + this.hipaaEnabled = hipaaEnabled; + this.clientMessages = clientMessages; + this.serverMessages = serverMessages; + this.silenceTimeoutSeconds = silenceTimeoutSeconds; + this.maxDurationSeconds = maxDurationSeconds; + this.backgroundSound = backgroundSound; + this.backchannelingEnabled = backchannelingEnabled; + this.backgroundDenoisingEnabled = backgroundDenoisingEnabled; + this.modelOutputInMessagesEnabled = modelOutputInMessagesEnabled; + this.transportConfigurations = transportConfigurations; + this.variableValues = variableValues; + this.name = name; + this.firstMessage = firstMessage; + this.voicemailDetection = voicemailDetection; + this.voicemailMessage = voicemailMessage; + this.endCallMessage = endCallMessage; + this.endCallPhrases = endCallPhrases; + this.metadata = metadata; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.analysisPlan = analysisPlan; + this.artifactPlan = artifactPlan; + this.messagePlan = messagePlan; + this.startSpeakingPlan = startSpeakingPlan; + this.stopSpeakingPlan = stopSpeakingPlan; + this.monitorPlan = monitorPlan; + this.credentialIds = credentialIds; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the options for the assistant's transcriber. + */ + @JsonProperty("transcriber") + public Optional getTranscriber() { + return transcriber; + } + + /** + * @return These are the options for the assistant's LLM. + */ + @JsonProperty("model") + public Optional getModel() { + return model; + } + + /** + * @return These are the options for the assistant's voice. + */ + @JsonProperty("voice") + public Optional getVoice() { + return voice; + } + + /** + * @return This is the mode for the first message. Default is 'assistant-speaks-first'. + *

Use:

+ *
    + *
  • 'assistant-speaks-first' to have the assistant speak first.
  • + *
  • 'assistant-waits-for-user' to have the assistant wait for the user to speak first.
  • + *
  • 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (assistant.model.messages at call start, call.messages at squad transfer points).
  • + *
+ *

@default 'assistant-speaks-first'

+ */ + @JsonProperty("firstMessageMode") + public Optional getFirstMessageMode() { + return firstMessageMode; + } + + /** + * @return When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false. + */ + @JsonProperty("hipaaEnabled") + public Optional getHipaaEnabled() { + return hipaaEnabled; + } + + /** + * @return These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema. + */ + @JsonProperty("clientMessages") + public Optional> getClientMessages() { + return clientMessages; + } + + /** + * @return These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,user-interrupted. You can check the shape of the messages in ServerMessage schema. + */ + @JsonProperty("serverMessages") + public Optional> getServerMessages() { + return serverMessages; + } + + /** + * @return How many seconds of silence to wait before ending the call. Defaults to 30. + *

@default 30

+ */ + @JsonProperty("silenceTimeoutSeconds") + public Optional getSilenceTimeoutSeconds() { + return silenceTimeoutSeconds; + } + + /** + * @return This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended. + *

@default 600 (10 minutes)

+ */ + @JsonProperty("maxDurationSeconds") + public Optional getMaxDurationSeconds() { + return maxDurationSeconds; + } + + /** + * @return This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'. + */ + @JsonProperty("backgroundSound") + public Optional getBackgroundSound() { + return backgroundSound; + } + + /** + * @return This determines whether the model says 'mhmm', 'ahem' etc. while user is speaking. + *

Default false while in beta.

+ *

@default false

+ */ + @JsonProperty("backchannelingEnabled") + public Optional getBackchannelingEnabled() { + return backchannelingEnabled; + } + + /** + * @return This enables filtering of noise and background speech while the user is talking. + *

Default false while in beta.

+ *

@default false

+ */ + @JsonProperty("backgroundDenoisingEnabled") + public Optional getBackgroundDenoisingEnabled() { + return backgroundDenoisingEnabled; + } + + /** + * @return This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech. + *

Default false while in beta.

+ *

@default false

+ */ + @JsonProperty("modelOutputInMessagesEnabled") + public Optional getModelOutputInMessagesEnabled() { + return modelOutputInMessagesEnabled; + } + + /** + * @return These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used. + */ + @JsonProperty("transportConfigurations") + public Optional> getTransportConfigurations() { + return transportConfigurations; + } + + /** + * @return These are values that will be used to replace the template variables in the assistant messages and other text-based fields. + */ + @JsonProperty("variableValues") + public Optional> getVariableValues() { + return variableValues; + } + + /** + * @return This is the name of the assistant. + *

This is required when you want to transfer between assistants in a call.

+ */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). + *

If unspecified, assistant will wait for user to speak and use the model to respond once they speak.

+ */ + @JsonProperty("firstMessage") + public Optional getFirstMessage() { + return firstMessage; + } + + /** + * @return These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. + * This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached. + * You can use neither of them, one of them, or both of them. By default, Twilio built-in detection is enabled while VoicemailTool is not. + */ + @JsonProperty("voicemailDetection") + public Optional getVoicemailDetection() { + return voicemailDetection; + } + + /** + * @return This is the message that the assistant will say if the call is forwarded to voicemail. + *

If unspecified, it will hang up.

+ */ + @JsonProperty("voicemailMessage") + public Optional getVoicemailMessage() { + return voicemailMessage; + } + + /** + * @return This is the message that the assistant will say if it ends the call. + *

If unspecified, it will hang up without saying anything.

+ */ + @JsonProperty("endCallMessage") + public Optional getEndCallMessage() { + return endCallMessage; + } + + /** + * @return This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive. + */ + @JsonProperty("endCallPhrases") + public Optional> getEndCallPhrases() { + return endCallPhrases; + } + + /** + * @return This is for metadata you want to store on the assistant. + */ + @JsonProperty("metadata") + public Optional> getMetadata() { + return metadata; + } + + /** + * @return This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports. + *

All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + /** + * @return This is the plan for analysis of assistant's calls. Stored in call.analysis. + */ + @JsonProperty("analysisPlan") + public Optional getAnalysisPlan() { + return analysisPlan; + } + + /** + * @return This is the plan for artifacts generated during assistant's calls. Stored in call.artifact. + *

Note: recordingEnabled is currently at the root level. It will be moved to artifactPlan in the future, but will remain backwards compatible.

+ */ + @JsonProperty("artifactPlan") + public Optional getArtifactPlan() { + return artifactPlan; + } + + /** + * @return This is the plan for static predefined messages that can be spoken by the assistant during the call, like idleMessages. + *

Note: firstMessage, voicemailMessage, and endCallMessage are currently at the root level. They will be moved to messagePlan in the future, but will remain backwards compatible.

+ */ + @JsonProperty("messagePlan") + public Optional getMessagePlan() { + return messagePlan; + } + + /** + * @return This is the plan for when the assistant should start talking. + *

You should configure this if you're running into these issues:

+ *
    + *
  • The assistant is too slow to start talking after the customer is done speaking.
  • + *
  • The assistant is too fast to start talking after the customer is done speaking.
  • + *
  • The assistant is so fast that it's actually interrupting the customer.
  • + *
+ */ + @JsonProperty("startSpeakingPlan") + public Optional getStartSpeakingPlan() { + return startSpeakingPlan; + } + + /** + * @return This is the plan for when assistant should stop talking on customer interruption. + *

You should configure this if you're running into these issues:

+ *
    + *
  • The assistant is too slow to recognize customer's interruption.
  • + *
  • The assistant is too fast to recognize customer's interruption.
  • + *
  • The assistant is getting interrupted by phrases that are just acknowledgments.
  • + *
  • The assistant is getting interrupted by background noises.
  • + *
  • The assistant is not properly stopping -- it starts talking right after getting interrupted.
  • + *
+ */ + @JsonProperty("stopSpeakingPlan") + public Optional getStopSpeakingPlan() { + return stopSpeakingPlan; + } + + /** + * @return This is the plan for real-time monitoring of the assistant's calls. + *

Usage:

+ *
    + *
  • To enable live listening of the assistant's calls, set monitorPlan.listenEnabled to true.
  • + *
  • To enable live control of the assistant's calls, set monitorPlan.controlEnabled to true.
  • + *
+ *

Note, serverMessages, clientMessages, serverUrl and serverUrlSecret are currently at the root level but will be moved to monitorPlan in the future. Will remain backwards compatible

+ */ + @JsonProperty("monitorPlan") + public Optional getMonitorPlan() { + return monitorPlan; + } + + /** + * @return These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this. + */ + @JsonProperty("credentialIds") + public Optional> getCredentialIds() { + return credentialIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AssistantOverrides && equalTo((AssistantOverrides) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AssistantOverrides other) { + return transcriber.equals(other.transcriber) + && model.equals(other.model) + && voice.equals(other.voice) + && firstMessageMode.equals(other.firstMessageMode) + && hipaaEnabled.equals(other.hipaaEnabled) + && clientMessages.equals(other.clientMessages) + && serverMessages.equals(other.serverMessages) + && silenceTimeoutSeconds.equals(other.silenceTimeoutSeconds) + && maxDurationSeconds.equals(other.maxDurationSeconds) + && backgroundSound.equals(other.backgroundSound) + && backchannelingEnabled.equals(other.backchannelingEnabled) + && backgroundDenoisingEnabled.equals(other.backgroundDenoisingEnabled) + && modelOutputInMessagesEnabled.equals(other.modelOutputInMessagesEnabled) + && transportConfigurations.equals(other.transportConfigurations) + && variableValues.equals(other.variableValues) + && name.equals(other.name) + && firstMessage.equals(other.firstMessage) + && voicemailDetection.equals(other.voicemailDetection) + && voicemailMessage.equals(other.voicemailMessage) + && endCallMessage.equals(other.endCallMessage) + && endCallPhrases.equals(other.endCallPhrases) + && metadata.equals(other.metadata) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret) + && analysisPlan.equals(other.analysisPlan) + && artifactPlan.equals(other.artifactPlan) + && messagePlan.equals(other.messagePlan) + && startSpeakingPlan.equals(other.startSpeakingPlan) + && stopSpeakingPlan.equals(other.stopSpeakingPlan) + && monitorPlan.equals(other.monitorPlan) + && credentialIds.equals(other.credentialIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.transcriber, + this.model, + this.voice, + this.firstMessageMode, + this.hipaaEnabled, + this.clientMessages, + this.serverMessages, + this.silenceTimeoutSeconds, + this.maxDurationSeconds, + this.backgroundSound, + this.backchannelingEnabled, + this.backgroundDenoisingEnabled, + this.modelOutputInMessagesEnabled, + this.transportConfigurations, + this.variableValues, + this.name, + this.firstMessage, + this.voicemailDetection, + this.voicemailMessage, + this.endCallMessage, + this.endCallPhrases, + this.metadata, + this.serverUrl, + this.serverUrlSecret, + this.analysisPlan, + this.artifactPlan, + this.messagePlan, + this.startSpeakingPlan, + this.stopSpeakingPlan, + this.monitorPlan, + this.credentialIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional transcriber = Optional.empty(); + + private Optional model = Optional.empty(); + + private Optional voice = Optional.empty(); + + private Optional firstMessageMode = Optional.empty(); + + private Optional hipaaEnabled = Optional.empty(); + + private Optional> clientMessages = Optional.empty(); + + private Optional> serverMessages = Optional.empty(); + + private Optional silenceTimeoutSeconds = Optional.empty(); + + private Optional maxDurationSeconds = Optional.empty(); + + private Optional backgroundSound = Optional.empty(); + + private Optional backchannelingEnabled = Optional.empty(); + + private Optional backgroundDenoisingEnabled = Optional.empty(); + + private Optional modelOutputInMessagesEnabled = Optional.empty(); + + private Optional> transportConfigurations = Optional.empty(); + + private Optional> variableValues = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional firstMessage = Optional.empty(); + + private Optional voicemailDetection = Optional.empty(); + + private Optional voicemailMessage = Optional.empty(); + + private Optional endCallMessage = Optional.empty(); + + private Optional> endCallPhrases = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional serverUrlSecret = Optional.empty(); + + private Optional analysisPlan = Optional.empty(); + + private Optional artifactPlan = Optional.empty(); + + private Optional messagePlan = Optional.empty(); + + private Optional startSpeakingPlan = Optional.empty(); + + private Optional stopSpeakingPlan = Optional.empty(); + + private Optional monitorPlan = Optional.empty(); + + private Optional> credentialIds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AssistantOverrides other) { + transcriber(other.getTranscriber()); + model(other.getModel()); + voice(other.getVoice()); + firstMessageMode(other.getFirstMessageMode()); + hipaaEnabled(other.getHipaaEnabled()); + clientMessages(other.getClientMessages()); + serverMessages(other.getServerMessages()); + silenceTimeoutSeconds(other.getSilenceTimeoutSeconds()); + maxDurationSeconds(other.getMaxDurationSeconds()); + backgroundSound(other.getBackgroundSound()); + backchannelingEnabled(other.getBackchannelingEnabled()); + backgroundDenoisingEnabled(other.getBackgroundDenoisingEnabled()); + modelOutputInMessagesEnabled(other.getModelOutputInMessagesEnabled()); + transportConfigurations(other.getTransportConfigurations()); + variableValues(other.getVariableValues()); + name(other.getName()); + firstMessage(other.getFirstMessage()); + voicemailDetection(other.getVoicemailDetection()); + voicemailMessage(other.getVoicemailMessage()); + endCallMessage(other.getEndCallMessage()); + endCallPhrases(other.getEndCallPhrases()); + metadata(other.getMetadata()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + analysisPlan(other.getAnalysisPlan()); + artifactPlan(other.getArtifactPlan()); + messagePlan(other.getMessagePlan()); + startSpeakingPlan(other.getStartSpeakingPlan()); + stopSpeakingPlan(other.getStopSpeakingPlan()); + monitorPlan(other.getMonitorPlan()); + credentialIds(other.getCredentialIds()); + return this; + } + + @JsonSetter(value = "transcriber", nulls = Nulls.SKIP) + public Builder transcriber(Optional transcriber) { + this.transcriber = transcriber; + return this; + } + + public Builder transcriber(AssistantOverridesTranscriber transcriber) { + this.transcriber = Optional.ofNullable(transcriber); + return this; + } + + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public Builder model(Optional model) { + this.model = model; + return this; + } + + public Builder model(AssistantOverridesModel model) { + this.model = Optional.ofNullable(model); + return this; + } + + @JsonSetter(value = "voice", nulls = Nulls.SKIP) + public Builder voice(Optional voice) { + this.voice = voice; + return this; + } + + public Builder voice(AssistantOverridesVoice voice) { + this.voice = Optional.ofNullable(voice); + return this; + } + + @JsonSetter(value = "firstMessageMode", nulls = Nulls.SKIP) + public Builder firstMessageMode(Optional firstMessageMode) { + this.firstMessageMode = firstMessageMode; + return this; + } + + public Builder firstMessageMode(AssistantOverridesFirstMessageMode firstMessageMode) { + this.firstMessageMode = Optional.ofNullable(firstMessageMode); + return this; + } + + @JsonSetter(value = "hipaaEnabled", nulls = Nulls.SKIP) + public Builder hipaaEnabled(Optional hipaaEnabled) { + this.hipaaEnabled = hipaaEnabled; + return this; + } + + public Builder hipaaEnabled(Boolean hipaaEnabled) { + this.hipaaEnabled = Optional.ofNullable(hipaaEnabled); + return this; + } + + @JsonSetter(value = "clientMessages", nulls = Nulls.SKIP) + public Builder clientMessages(Optional> clientMessages) { + this.clientMessages = clientMessages; + return this; + } + + public Builder clientMessages(List clientMessages) { + this.clientMessages = Optional.ofNullable(clientMessages); + return this; + } + + @JsonSetter(value = "serverMessages", nulls = Nulls.SKIP) + public Builder serverMessages(Optional> serverMessages) { + this.serverMessages = serverMessages; + return this; + } + + public Builder serverMessages(List serverMessages) { + this.serverMessages = Optional.ofNullable(serverMessages); + return this; + } + + @JsonSetter(value = "silenceTimeoutSeconds", nulls = Nulls.SKIP) + public Builder silenceTimeoutSeconds(Optional silenceTimeoutSeconds) { + this.silenceTimeoutSeconds = silenceTimeoutSeconds; + return this; + } + + public Builder silenceTimeoutSeconds(Double silenceTimeoutSeconds) { + this.silenceTimeoutSeconds = Optional.ofNullable(silenceTimeoutSeconds); + return this; + } + + @JsonSetter(value = "maxDurationSeconds", nulls = Nulls.SKIP) + public Builder maxDurationSeconds(Optional maxDurationSeconds) { + this.maxDurationSeconds = maxDurationSeconds; + return this; + } + + public Builder maxDurationSeconds(Double maxDurationSeconds) { + this.maxDurationSeconds = Optional.ofNullable(maxDurationSeconds); + return this; + } + + @JsonSetter(value = "backgroundSound", nulls = Nulls.SKIP) + public Builder backgroundSound(Optional backgroundSound) { + this.backgroundSound = backgroundSound; + return this; + } + + public Builder backgroundSound(AssistantOverridesBackgroundSound backgroundSound) { + this.backgroundSound = Optional.ofNullable(backgroundSound); + return this; + } + + @JsonSetter(value = "backchannelingEnabled", nulls = Nulls.SKIP) + public Builder backchannelingEnabled(Optional backchannelingEnabled) { + this.backchannelingEnabled = backchannelingEnabled; + return this; + } + + public Builder backchannelingEnabled(Boolean backchannelingEnabled) { + this.backchannelingEnabled = Optional.ofNullable(backchannelingEnabled); + return this; + } + + @JsonSetter(value = "backgroundDenoisingEnabled", nulls = Nulls.SKIP) + public Builder backgroundDenoisingEnabled(Optional backgroundDenoisingEnabled) { + this.backgroundDenoisingEnabled = backgroundDenoisingEnabled; + return this; + } + + public Builder backgroundDenoisingEnabled(Boolean backgroundDenoisingEnabled) { + this.backgroundDenoisingEnabled = Optional.ofNullable(backgroundDenoisingEnabled); + return this; + } + + @JsonSetter(value = "modelOutputInMessagesEnabled", nulls = Nulls.SKIP) + public Builder modelOutputInMessagesEnabled(Optional modelOutputInMessagesEnabled) { + this.modelOutputInMessagesEnabled = modelOutputInMessagesEnabled; + return this; + } + + public Builder modelOutputInMessagesEnabled(Boolean modelOutputInMessagesEnabled) { + this.modelOutputInMessagesEnabled = Optional.ofNullable(modelOutputInMessagesEnabled); + return this; + } + + @JsonSetter(value = "transportConfigurations", nulls = Nulls.SKIP) + public Builder transportConfigurations(Optional> transportConfigurations) { + this.transportConfigurations = transportConfigurations; + return this; + } + + public Builder transportConfigurations(List transportConfigurations) { + this.transportConfigurations = Optional.ofNullable(transportConfigurations); + return this; + } + + @JsonSetter(value = "variableValues", nulls = Nulls.SKIP) + public Builder variableValues(Optional> variableValues) { + this.variableValues = variableValues; + return this; + } + + public Builder variableValues(Map variableValues) { + this.variableValues = Optional.ofNullable(variableValues); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "firstMessage", nulls = Nulls.SKIP) + public Builder firstMessage(Optional firstMessage) { + this.firstMessage = firstMessage; + return this; + } + + public Builder firstMessage(String firstMessage) { + this.firstMessage = Optional.ofNullable(firstMessage); + return this; + } + + @JsonSetter(value = "voicemailDetection", nulls = Nulls.SKIP) + public Builder voicemailDetection(Optional voicemailDetection) { + this.voicemailDetection = voicemailDetection; + return this; + } + + public Builder voicemailDetection(TwilioVoicemailDetection voicemailDetection) { + this.voicemailDetection = Optional.ofNullable(voicemailDetection); + return this; + } + + @JsonSetter(value = "voicemailMessage", nulls = Nulls.SKIP) + public Builder voicemailMessage(Optional voicemailMessage) { + this.voicemailMessage = voicemailMessage; + return this; + } + + public Builder voicemailMessage(String voicemailMessage) { + this.voicemailMessage = Optional.ofNullable(voicemailMessage); + return this; + } + + @JsonSetter(value = "endCallMessage", nulls = Nulls.SKIP) + public Builder endCallMessage(Optional endCallMessage) { + this.endCallMessage = endCallMessage; + return this; + } + + public Builder endCallMessage(String endCallMessage) { + this.endCallMessage = Optional.ofNullable(endCallMessage); + return this; + } + + @JsonSetter(value = "endCallPhrases", nulls = Nulls.SKIP) + public Builder endCallPhrases(Optional> endCallPhrases) { + this.endCallPhrases = endCallPhrases; + return this; + } + + public Builder endCallPhrases(List endCallPhrases) { + this.endCallPhrases = Optional.ofNullable(endCallPhrases); + return this; + } + + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public Builder serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + public Builder serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public Builder serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + public Builder serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @JsonSetter(value = "analysisPlan", nulls = Nulls.SKIP) + public Builder analysisPlan(Optional analysisPlan) { + this.analysisPlan = analysisPlan; + return this; + } + + public Builder analysisPlan(AnalysisPlan analysisPlan) { + this.analysisPlan = Optional.ofNullable(analysisPlan); + return this; + } + + @JsonSetter(value = "artifactPlan", nulls = Nulls.SKIP) + public Builder artifactPlan(Optional artifactPlan) { + this.artifactPlan = artifactPlan; + return this; + } + + public Builder artifactPlan(ArtifactPlan artifactPlan) { + this.artifactPlan = Optional.ofNullable(artifactPlan); + return this; + } + + @JsonSetter(value = "messagePlan", nulls = Nulls.SKIP) + public Builder messagePlan(Optional messagePlan) { + this.messagePlan = messagePlan; + return this; + } + + public Builder messagePlan(MessagePlan messagePlan) { + this.messagePlan = Optional.ofNullable(messagePlan); + return this; + } + + @JsonSetter(value = "startSpeakingPlan", nulls = Nulls.SKIP) + public Builder startSpeakingPlan(Optional startSpeakingPlan) { + this.startSpeakingPlan = startSpeakingPlan; + return this; + } + + public Builder startSpeakingPlan(StartSpeakingPlan startSpeakingPlan) { + this.startSpeakingPlan = Optional.ofNullable(startSpeakingPlan); + return this; + } + + @JsonSetter(value = "stopSpeakingPlan", nulls = Nulls.SKIP) + public Builder stopSpeakingPlan(Optional stopSpeakingPlan) { + this.stopSpeakingPlan = stopSpeakingPlan; + return this; + } + + public Builder stopSpeakingPlan(StopSpeakingPlan stopSpeakingPlan) { + this.stopSpeakingPlan = Optional.ofNullable(stopSpeakingPlan); + return this; + } + + @JsonSetter(value = "monitorPlan", nulls = Nulls.SKIP) + public Builder monitorPlan(Optional monitorPlan) { + this.monitorPlan = monitorPlan; + return this; + } + + public Builder monitorPlan(MonitorPlan monitorPlan) { + this.monitorPlan = Optional.ofNullable(monitorPlan); + return this; + } + + @JsonSetter(value = "credentialIds", nulls = Nulls.SKIP) + public Builder credentialIds(Optional> credentialIds) { + this.credentialIds = credentialIds; + return this; + } + + public Builder credentialIds(List credentialIds) { + this.credentialIds = Optional.ofNullable(credentialIds); + return this; + } + + public AssistantOverrides build() { + return new AssistantOverrides( + transcriber, + model, + voice, + firstMessageMode, + hipaaEnabled, + clientMessages, + serverMessages, + silenceTimeoutSeconds, + maxDurationSeconds, + backgroundSound, + backchannelingEnabled, + backgroundDenoisingEnabled, + modelOutputInMessagesEnabled, + transportConfigurations, + variableValues, + name, + firstMessage, + voicemailDetection, + voicemailMessage, + endCallMessage, + endCallPhrases, + metadata, + serverUrl, + serverUrlSecret, + analysisPlan, + artifactPlan, + messagePlan, + startSpeakingPlan, + stopSpeakingPlan, + monitorPlan, + credentialIds, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AssistantOverridesBackgroundSound.java b/src/main/java/com/vapi/api/types/AssistantOverridesBackgroundSound.java new file mode 100644 index 0000000..6cdcd1e --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssistantOverridesBackgroundSound.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AssistantOverridesBackgroundSound { + OFF("off"), + + OFFICE("office"); + + private final String value; + + AssistantOverridesBackgroundSound(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/AssistantOverridesClientMessagesItem.java b/src/main/java/com/vapi/api/types/AssistantOverridesClientMessagesItem.java new file mode 100644 index 0000000..ad50794 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssistantOverridesClientMessagesItem.java @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AssistantOverridesClientMessagesItem { + CONVERSATION_UPDATE("conversation-update"), + + FUNCTION_CALL("function-call"), + + FUNCTION_CALL_RESULT("function-call-result"), + + HANG("hang"), + + LANGUAGE_CHANGED("language-changed"), + + METADATA("metadata"), + + MODEL_OUTPUT("model-output"), + + SPEECH_UPDATE("speech-update"), + + STATUS_UPDATE("status-update"), + + TRANSCRIPT("transcript"), + + TOOL_CALLS("tool-calls"), + + TOOL_CALLS_RESULT("tool-calls-result"), + + USER_INTERRUPTED("user-interrupted"), + + VOICE_INPUT("voice-input"); + + private final String value; + + AssistantOverridesClientMessagesItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/AssistantOverridesFirstMessageMode.java b/src/main/java/com/vapi/api/types/AssistantOverridesFirstMessageMode.java new file mode 100644 index 0000000..04c36c3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssistantOverridesFirstMessageMode.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AssistantOverridesFirstMessageMode { + ASSISTANT_SPEAKS_FIRST("assistant-speaks-first"), + + ASSISTANT_SPEAKS_FIRST_WITH_MODEL_GENERATED_MESSAGE("assistant-speaks-first-with-model-generated-message"), + + ASSISTANT_WAITS_FOR_USER("assistant-waits-for-user"); + + private final String value; + + AssistantOverridesFirstMessageMode(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/AssistantOverridesModel.java b/src/main/java/com/vapi/api/types/AssistantOverridesModel.java new file mode 100644 index 0000000..e0be148 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssistantOverridesModel.java @@ -0,0 +1,651 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class AssistantOverridesModel { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private AssistantOverridesModel(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static AssistantOverridesModel anyscale(AnyscaleModel value) { + return new AssistantOverridesModel(new AnyscaleValue(value)); + } + + public static AssistantOverridesModel anthropic(AnthropicModel value) { + return new AssistantOverridesModel(new AnthropicValue(value)); + } + + public static AssistantOverridesModel customLlm(CustomLlmModel value) { + return new AssistantOverridesModel(new CustomLlmValue(value)); + } + + public static AssistantOverridesModel deepinfra(DeepInfraModel value) { + return new AssistantOverridesModel(new DeepinfraValue(value)); + } + + public static AssistantOverridesModel groq(GroqModel value) { + return new AssistantOverridesModel(new GroqValue(value)); + } + + public static AssistantOverridesModel openai(OpenAiModel value) { + return new AssistantOverridesModel(new OpenaiValue(value)); + } + + public static AssistantOverridesModel openrouter(OpenRouterModel value) { + return new AssistantOverridesModel(new OpenrouterValue(value)); + } + + public static AssistantOverridesModel perplexityAi(PerplexityAiModel value) { + return new AssistantOverridesModel(new PerplexityAiValue(value)); + } + + public static AssistantOverridesModel togetherAi(TogetherAiModel value) { + return new AssistantOverridesModel(new TogetherAiValue(value)); + } + + public static AssistantOverridesModel vapi(VapiModel value) { + return new AssistantOverridesModel(new VapiValue(value)); + } + + public boolean isAnyscale() { + return value instanceof AnyscaleValue; + } + + public boolean isAnthropic() { + return value instanceof AnthropicValue; + } + + public boolean isCustomLlm() { + return value instanceof CustomLlmValue; + } + + public boolean isDeepinfra() { + return value instanceof DeepinfraValue; + } + + public boolean isGroq() { + return value instanceof GroqValue; + } + + public boolean isOpenai() { + return value instanceof OpenaiValue; + } + + public boolean isOpenrouter() { + return value instanceof OpenrouterValue; + } + + public boolean isPerplexityAi() { + return value instanceof PerplexityAiValue; + } + + public boolean isTogetherAi() { + return value instanceof TogetherAiValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAnyscale() { + if (isAnyscale()) { + return Optional.of(((AnyscaleValue) value).value); + } + return Optional.empty(); + } + + public Optional getAnthropic() { + if (isAnthropic()) { + return Optional.of(((AnthropicValue) value).value); + } + return Optional.empty(); + } + + public Optional getCustomLlm() { + if (isCustomLlm()) { + return Optional.of(((CustomLlmValue) value).value); + } + return Optional.empty(); + } + + public Optional getDeepinfra() { + if (isDeepinfra()) { + return Optional.of(((DeepinfraValue) value).value); + } + return Optional.empty(); + } + + public Optional getGroq() { + if (isGroq()) { + return Optional.of(((GroqValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenai() { + if (isOpenai()) { + return Optional.of(((OpenaiValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenrouter() { + if (isOpenrouter()) { + return Optional.of(((OpenrouterValue) value).value); + } + return Optional.empty(); + } + + public Optional getPerplexityAi() { + if (isPerplexityAi()) { + return Optional.of(((PerplexityAiValue) value).value); + } + return Optional.empty(); + } + + public Optional getTogetherAi() { + if (isTogetherAi()) { + return Optional.of(((TogetherAiValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAnyscale(AnyscaleModel anyscale); + + T visitAnthropic(AnthropicModel anthropic); + + T visitCustomLlm(CustomLlmModel customLlm); + + T visitDeepinfra(DeepInfraModel deepinfra); + + T visitGroq(GroqModel groq); + + T visitOpenai(OpenAiModel openai); + + T visitOpenrouter(OpenRouterModel openrouter); + + T visitPerplexityAi(PerplexityAiModel perplexityAi); + + T visitTogetherAi(TogetherAiModel togetherAi); + + T visitVapi(VapiModel vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AnyscaleValue.class), + @JsonSubTypes.Type(AnthropicValue.class), + @JsonSubTypes.Type(CustomLlmValue.class), + @JsonSubTypes.Type(DeepinfraValue.class), + @JsonSubTypes.Type(GroqValue.class), + @JsonSubTypes.Type(OpenaiValue.class), + @JsonSubTypes.Type(OpenrouterValue.class), + @JsonSubTypes.Type(PerplexityAiValue.class), + @JsonSubTypes.Type(TogetherAiValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("anyscale") + private static final class AnyscaleValue implements Value { + @JsonUnwrapped + private AnyscaleModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AnyscaleValue() {} + + private AnyscaleValue(AnyscaleModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAnyscale(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnyscaleValue && equalTo((AnyscaleValue) other); + } + + private boolean equalTo(AnyscaleValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("anthropic") + private static final class AnthropicValue implements Value { + @JsonUnwrapped + private AnthropicModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AnthropicValue() {} + + private AnthropicValue(AnthropicModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAnthropic(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnthropicValue && equalTo((AnthropicValue) other); + } + + private boolean equalTo(AnthropicValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("custom-llm") + private static final class CustomLlmValue implements Value { + @JsonUnwrapped + private CustomLlmModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CustomLlmValue() {} + + private CustomLlmValue(CustomLlmModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCustomLlm(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CustomLlmValue && equalTo((CustomLlmValue) other); + } + + private boolean equalTo(CustomLlmValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("deepinfra") + private static final class DeepinfraValue implements Value { + @JsonUnwrapped + private DeepInfraModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepinfraValue() {} + + private DeepinfraValue(DeepInfraModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDeepinfra(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepinfraValue && equalTo((DeepinfraValue) other); + } + + private boolean equalTo(DeepinfraValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("groq") + private static final class GroqValue implements Value { + @JsonUnwrapped + private GroqModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GroqValue() {} + + private GroqValue(GroqModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGroq(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GroqValue && equalTo((GroqValue) other); + } + + private boolean equalTo(GroqValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("openai") + private static final class OpenaiValue implements Value { + @JsonUnwrapped + private OpenAiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenaiValue() {} + + private OpenaiValue(OpenAiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOpenai(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenaiValue && equalTo((OpenaiValue) other); + } + + private boolean equalTo(OpenaiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("openrouter") + private static final class OpenrouterValue implements Value { + @JsonUnwrapped + private OpenRouterModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenrouterValue() {} + + private OpenrouterValue(OpenRouterModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOpenrouter(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenrouterValue && equalTo((OpenrouterValue) other); + } + + private boolean equalTo(OpenrouterValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("perplexity-ai") + private static final class PerplexityAiValue implements Value { + @JsonUnwrapped + private PerplexityAiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private PerplexityAiValue() {} + + private PerplexityAiValue(PerplexityAiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitPerplexityAi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PerplexityAiValue && equalTo((PerplexityAiValue) other); + } + + private boolean equalTo(PerplexityAiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("together-ai") + private static final class TogetherAiValue implements Value { + @JsonUnwrapped + private TogetherAiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TogetherAiValue() {} + + private TogetherAiValue(TogetherAiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTogetherAi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TogetherAiValue && equalTo((TogetherAiValue) other); + } + + private boolean equalTo(TogetherAiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private VapiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(VapiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesModel{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesModel{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/AssistantOverridesServerMessagesItem.java b/src/main/java/com/vapi/api/types/AssistantOverridesServerMessagesItem.java new file mode 100644 index 0000000..3d0608b --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssistantOverridesServerMessagesItem.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AssistantOverridesServerMessagesItem { + CONVERSATION_UPDATE("conversation-update"), + + END_OF_CALL_REPORT("end-of-call-report"), + + FUNCTION_CALL("function-call"), + + HANG("hang"), + + LANGUAGE_CHANGED("language-changed"), + + MODEL_OUTPUT("model-output"), + + PHONE_CALL_CONTROL("phone-call-control"), + + SPEECH_UPDATE("speech-update"), + + STATUS_UPDATE("status-update"), + + TRANSCRIPT("transcript"), + + TOOL_CALLS("tool-calls"), + + TRANSFER_DESTINATION_REQUEST("transfer-destination-request"), + + TRANSFER_UPDATE("transfer-update"), + + USER_INTERRUPTED("user-interrupted"), + + VOICE_INPUT("voice-input"); + + private final String value; + + AssistantOverridesServerMessagesItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/AssistantOverridesTranscriber.java b/src/main/java/com/vapi/api/types/AssistantOverridesTranscriber.java new file mode 100644 index 0000000..03e56c3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssistantOverridesTranscriber.java @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class AssistantOverridesTranscriber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private AssistantOverridesTranscriber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static AssistantOverridesTranscriber deepgram(DeepgramTranscriber value) { + return new AssistantOverridesTranscriber(new DeepgramValue(value)); + } + + public static AssistantOverridesTranscriber gladia(GladiaTranscriber value) { + return new AssistantOverridesTranscriber(new GladiaValue(value)); + } + + public static AssistantOverridesTranscriber talkscriber(TalkscriberTranscriber value) { + return new AssistantOverridesTranscriber(new TalkscriberValue(value)); + } + + public boolean isDeepgram() { + return value instanceof DeepgramValue; + } + + public boolean isGladia() { + return value instanceof GladiaValue; + } + + public boolean isTalkscriber() { + return value instanceof TalkscriberValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDeepgram() { + if (isDeepgram()) { + return Optional.of(((DeepgramValue) value).value); + } + return Optional.empty(); + } + + public Optional getGladia() { + if (isGladia()) { + return Optional.of(((GladiaValue) value).value); + } + return Optional.empty(); + } + + public Optional getTalkscriber() { + if (isTalkscriber()) { + return Optional.of(((TalkscriberValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDeepgram(DeepgramTranscriber deepgram); + + T visitGladia(GladiaTranscriber gladia); + + T visitTalkscriber(TalkscriberTranscriber talkscriber); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DeepgramValue.class), + @JsonSubTypes.Type(GladiaValue.class), + @JsonSubTypes.Type(TalkscriberValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("deepgram") + private static final class DeepgramValue implements Value { + @JsonUnwrapped + private DeepgramTranscriber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepgramValue() {} + + private DeepgramValue(DeepgramTranscriber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDeepgram(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepgramValue && equalTo((DeepgramValue) other); + } + + private boolean equalTo(DeepgramValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesTranscriber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("gladia") + private static final class GladiaValue implements Value { + @JsonUnwrapped + private GladiaTranscriber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GladiaValue() {} + + private GladiaValue(GladiaTranscriber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGladia(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GladiaValue && equalTo((GladiaValue) other); + } + + private boolean equalTo(GladiaValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesTranscriber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("talkscriber") + private static final class TalkscriberValue implements Value { + @JsonUnwrapped + private TalkscriberTranscriber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TalkscriberValue() {} + + private TalkscriberValue(TalkscriberTranscriber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTalkscriber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TalkscriberValue && equalTo((TalkscriberValue) other); + } + + private boolean equalTo(TalkscriberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesTranscriber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesTranscriber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/AssistantOverridesVoice.java b/src/main/java/com/vapi/api/types/AssistantOverridesVoice.java new file mode 100644 index 0000000..817aefe --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssistantOverridesVoice.java @@ -0,0 +1,595 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class AssistantOverridesVoice { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private AssistantOverridesVoice(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static AssistantOverridesVoice azure(AzureVoice value) { + return new AssistantOverridesVoice(new AzureValue(value)); + } + + public static AssistantOverridesVoice cartesia(CartesiaVoice value) { + return new AssistantOverridesVoice(new CartesiaValue(value)); + } + + public static AssistantOverridesVoice deepgram(DeepgramVoice value) { + return new AssistantOverridesVoice(new DeepgramValue(value)); + } + + public static AssistantOverridesVoice _11Labs(ElevenLabsVoice value) { + return new AssistantOverridesVoice(new _11LabsValue(value)); + } + + public static AssistantOverridesVoice lmnt(LmntVoice value) { + return new AssistantOverridesVoice(new LmntValue(value)); + } + + public static AssistantOverridesVoice neets(NeetsVoice value) { + return new AssistantOverridesVoice(new NeetsValue(value)); + } + + public static AssistantOverridesVoice openai(OpenAiVoice value) { + return new AssistantOverridesVoice(new OpenaiValue(value)); + } + + public static AssistantOverridesVoice playht(PlayHtVoice value) { + return new AssistantOverridesVoice(new PlayhtValue(value)); + } + + public static AssistantOverridesVoice rimeAi(RimeAiVoice value) { + return new AssistantOverridesVoice(new RimeAiValue(value)); + } + + public boolean isAzure() { + return value instanceof AzureValue; + } + + public boolean isCartesia() { + return value instanceof CartesiaValue; + } + + public boolean isDeepgram() { + return value instanceof DeepgramValue; + } + + public boolean is11Labs() { + return value instanceof _11LabsValue; + } + + public boolean isLmnt() { + return value instanceof LmntValue; + } + + public boolean isNeets() { + return value instanceof NeetsValue; + } + + public boolean isOpenai() { + return value instanceof OpenaiValue; + } + + public boolean isPlayht() { + return value instanceof PlayhtValue; + } + + public boolean isRimeAi() { + return value instanceof RimeAiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAzure() { + if (isAzure()) { + return Optional.of(((AzureValue) value).value); + } + return Optional.empty(); + } + + public Optional getCartesia() { + if (isCartesia()) { + return Optional.of(((CartesiaValue) value).value); + } + return Optional.empty(); + } + + public Optional getDeepgram() { + if (isDeepgram()) { + return Optional.of(((DeepgramValue) value).value); + } + return Optional.empty(); + } + + public Optional get11Labs() { + if (is11Labs()) { + return Optional.of(((_11LabsValue) value).value); + } + return Optional.empty(); + } + + public Optional getLmnt() { + if (isLmnt()) { + return Optional.of(((LmntValue) value).value); + } + return Optional.empty(); + } + + public Optional getNeets() { + if (isNeets()) { + return Optional.of(((NeetsValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenai() { + if (isOpenai()) { + return Optional.of(((OpenaiValue) value).value); + } + return Optional.empty(); + } + + public Optional getPlayht() { + if (isPlayht()) { + return Optional.of(((PlayhtValue) value).value); + } + return Optional.empty(); + } + + public Optional getRimeAi() { + if (isRimeAi()) { + return Optional.of(((RimeAiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAzure(AzureVoice azure); + + T visitCartesia(CartesiaVoice cartesia); + + T visitDeepgram(DeepgramVoice deepgram); + + T visit11Labs(ElevenLabsVoice _11Labs); + + T visitLmnt(LmntVoice lmnt); + + T visitNeets(NeetsVoice neets); + + T visitOpenai(OpenAiVoice openai); + + T visitPlayht(PlayHtVoice playht); + + T visitRimeAi(RimeAiVoice rimeAi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AzureValue.class), + @JsonSubTypes.Type(CartesiaValue.class), + @JsonSubTypes.Type(DeepgramValue.class), + @JsonSubTypes.Type(_11LabsValue.class), + @JsonSubTypes.Type(LmntValue.class), + @JsonSubTypes.Type(NeetsValue.class), + @JsonSubTypes.Type(OpenaiValue.class), + @JsonSubTypes.Type(PlayhtValue.class), + @JsonSubTypes.Type(RimeAiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("azure") + private static final class AzureValue implements Value { + @JsonUnwrapped + private AzureVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AzureValue() {} + + private AzureValue(AzureVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAzure(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AzureValue && equalTo((AzureValue) other); + } + + private boolean equalTo(AzureValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("cartesia") + private static final class CartesiaValue implements Value { + @JsonUnwrapped + private CartesiaVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CartesiaValue() {} + + private CartesiaValue(CartesiaVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCartesia(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CartesiaValue && equalTo((CartesiaValue) other); + } + + private boolean equalTo(CartesiaValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("deepgram") + private static final class DeepgramValue implements Value { + @JsonUnwrapped + private DeepgramVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepgramValue() {} + + private DeepgramValue(DeepgramVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDeepgram(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepgramValue && equalTo((DeepgramValue) other); + } + + private boolean equalTo(DeepgramValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("11labs") + private static final class _11LabsValue implements Value { + @JsonUnwrapped + private ElevenLabsVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _11LabsValue() {} + + private _11LabsValue(ElevenLabsVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visit11Labs(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _11LabsValue && equalTo((_11LabsValue) other); + } + + private boolean equalTo(_11LabsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("lmnt") + private static final class LmntValue implements Value { + @JsonUnwrapped + private LmntVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private LmntValue() {} + + private LmntValue(LmntVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitLmnt(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LmntValue && equalTo((LmntValue) other); + } + + private boolean equalTo(LmntValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("neets") + private static final class NeetsValue implements Value { + @JsonUnwrapped + private NeetsVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NeetsValue() {} + + private NeetsValue(NeetsVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNeets(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NeetsValue && equalTo((NeetsValue) other); + } + + private boolean equalTo(NeetsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("openai") + private static final class OpenaiValue implements Value { + @JsonUnwrapped + private OpenAiVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenaiValue() {} + + private OpenaiValue(OpenAiVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOpenai(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenaiValue && equalTo((OpenaiValue) other); + } + + private boolean equalTo(OpenaiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("playht") + private static final class PlayhtValue implements Value { + @JsonUnwrapped + private PlayHtVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private PlayhtValue() {} + + private PlayhtValue(PlayHtVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitPlayht(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlayhtValue && equalTo((PlayhtValue) other); + } + + private boolean equalTo(PlayhtValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("rime-ai") + private static final class RimeAiValue implements Value { + @JsonUnwrapped + private RimeAiVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RimeAiValue() {} + + private RimeAiValue(RimeAiVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRimeAi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RimeAiValue && equalTo((RimeAiValue) other); + } + + private boolean equalTo(RimeAiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesVoice{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantOverridesVoice{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/AssistantServerMessagesItem.java b/src/main/java/com/vapi/api/types/AssistantServerMessagesItem.java new file mode 100644 index 0000000..5086ceb --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssistantServerMessagesItem.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AssistantServerMessagesItem { + CONVERSATION_UPDATE("conversation-update"), + + END_OF_CALL_REPORT("end-of-call-report"), + + FUNCTION_CALL("function-call"), + + HANG("hang"), + + LANGUAGE_CHANGED("language-changed"), + + MODEL_OUTPUT("model-output"), + + PHONE_CALL_CONTROL("phone-call-control"), + + SPEECH_UPDATE("speech-update"), + + STATUS_UPDATE("status-update"), + + TRANSCRIPT("transcript"), + + TOOL_CALLS("tool-calls"), + + TRANSFER_DESTINATION_REQUEST("transfer-destination-request"), + + TRANSFER_UPDATE("transfer-update"), + + USER_INTERRUPTED("user-interrupted"), + + VOICE_INPUT("voice-input"); + + private final String value; + + AssistantServerMessagesItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/AssistantTranscriber.java b/src/main/java/com/vapi/api/types/AssistantTranscriber.java new file mode 100644 index 0000000..f472650 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssistantTranscriber.java @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class AssistantTranscriber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private AssistantTranscriber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static AssistantTranscriber deepgram(DeepgramTranscriber value) { + return new AssistantTranscriber(new DeepgramValue(value)); + } + + public static AssistantTranscriber gladia(GladiaTranscriber value) { + return new AssistantTranscriber(new GladiaValue(value)); + } + + public static AssistantTranscriber talkscriber(TalkscriberTranscriber value) { + return new AssistantTranscriber(new TalkscriberValue(value)); + } + + public boolean isDeepgram() { + return value instanceof DeepgramValue; + } + + public boolean isGladia() { + return value instanceof GladiaValue; + } + + public boolean isTalkscriber() { + return value instanceof TalkscriberValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDeepgram() { + if (isDeepgram()) { + return Optional.of(((DeepgramValue) value).value); + } + return Optional.empty(); + } + + public Optional getGladia() { + if (isGladia()) { + return Optional.of(((GladiaValue) value).value); + } + return Optional.empty(); + } + + public Optional getTalkscriber() { + if (isTalkscriber()) { + return Optional.of(((TalkscriberValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDeepgram(DeepgramTranscriber deepgram); + + T visitGladia(GladiaTranscriber gladia); + + T visitTalkscriber(TalkscriberTranscriber talkscriber); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DeepgramValue.class), + @JsonSubTypes.Type(GladiaValue.class), + @JsonSubTypes.Type(TalkscriberValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("deepgram") + private static final class DeepgramValue implements Value { + @JsonUnwrapped + private DeepgramTranscriber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepgramValue() {} + + private DeepgramValue(DeepgramTranscriber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDeepgram(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepgramValue && equalTo((DeepgramValue) other); + } + + private boolean equalTo(DeepgramValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantTranscriber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("gladia") + private static final class GladiaValue implements Value { + @JsonUnwrapped + private GladiaTranscriber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GladiaValue() {} + + private GladiaValue(GladiaTranscriber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGladia(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GladiaValue && equalTo((GladiaValue) other); + } + + private boolean equalTo(GladiaValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantTranscriber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("talkscriber") + private static final class TalkscriberValue implements Value { + @JsonUnwrapped + private TalkscriberTranscriber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TalkscriberValue() {} + + private TalkscriberValue(TalkscriberTranscriber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTalkscriber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TalkscriberValue && equalTo((TalkscriberValue) other); + } + + private boolean equalTo(TalkscriberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantTranscriber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantTranscriber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/AssistantVoice.java b/src/main/java/com/vapi/api/types/AssistantVoice.java new file mode 100644 index 0000000..29d2dfd --- /dev/null +++ b/src/main/java/com/vapi/api/types/AssistantVoice.java @@ -0,0 +1,595 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class AssistantVoice { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private AssistantVoice(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static AssistantVoice azure(AzureVoice value) { + return new AssistantVoice(new AzureValue(value)); + } + + public static AssistantVoice cartesia(CartesiaVoice value) { + return new AssistantVoice(new CartesiaValue(value)); + } + + public static AssistantVoice deepgram(DeepgramVoice value) { + return new AssistantVoice(new DeepgramValue(value)); + } + + public static AssistantVoice _11Labs(ElevenLabsVoice value) { + return new AssistantVoice(new _11LabsValue(value)); + } + + public static AssistantVoice lmnt(LmntVoice value) { + return new AssistantVoice(new LmntValue(value)); + } + + public static AssistantVoice neets(NeetsVoice value) { + return new AssistantVoice(new NeetsValue(value)); + } + + public static AssistantVoice openai(OpenAiVoice value) { + return new AssistantVoice(new OpenaiValue(value)); + } + + public static AssistantVoice playht(PlayHtVoice value) { + return new AssistantVoice(new PlayhtValue(value)); + } + + public static AssistantVoice rimeAi(RimeAiVoice value) { + return new AssistantVoice(new RimeAiValue(value)); + } + + public boolean isAzure() { + return value instanceof AzureValue; + } + + public boolean isCartesia() { + return value instanceof CartesiaValue; + } + + public boolean isDeepgram() { + return value instanceof DeepgramValue; + } + + public boolean is11Labs() { + return value instanceof _11LabsValue; + } + + public boolean isLmnt() { + return value instanceof LmntValue; + } + + public boolean isNeets() { + return value instanceof NeetsValue; + } + + public boolean isOpenai() { + return value instanceof OpenaiValue; + } + + public boolean isPlayht() { + return value instanceof PlayhtValue; + } + + public boolean isRimeAi() { + return value instanceof RimeAiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAzure() { + if (isAzure()) { + return Optional.of(((AzureValue) value).value); + } + return Optional.empty(); + } + + public Optional getCartesia() { + if (isCartesia()) { + return Optional.of(((CartesiaValue) value).value); + } + return Optional.empty(); + } + + public Optional getDeepgram() { + if (isDeepgram()) { + return Optional.of(((DeepgramValue) value).value); + } + return Optional.empty(); + } + + public Optional get11Labs() { + if (is11Labs()) { + return Optional.of(((_11LabsValue) value).value); + } + return Optional.empty(); + } + + public Optional getLmnt() { + if (isLmnt()) { + return Optional.of(((LmntValue) value).value); + } + return Optional.empty(); + } + + public Optional getNeets() { + if (isNeets()) { + return Optional.of(((NeetsValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenai() { + if (isOpenai()) { + return Optional.of(((OpenaiValue) value).value); + } + return Optional.empty(); + } + + public Optional getPlayht() { + if (isPlayht()) { + return Optional.of(((PlayhtValue) value).value); + } + return Optional.empty(); + } + + public Optional getRimeAi() { + if (isRimeAi()) { + return Optional.of(((RimeAiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAzure(AzureVoice azure); + + T visitCartesia(CartesiaVoice cartesia); + + T visitDeepgram(DeepgramVoice deepgram); + + T visit11Labs(ElevenLabsVoice _11Labs); + + T visitLmnt(LmntVoice lmnt); + + T visitNeets(NeetsVoice neets); + + T visitOpenai(OpenAiVoice openai); + + T visitPlayht(PlayHtVoice playht); + + T visitRimeAi(RimeAiVoice rimeAi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AzureValue.class), + @JsonSubTypes.Type(CartesiaValue.class), + @JsonSubTypes.Type(DeepgramValue.class), + @JsonSubTypes.Type(_11LabsValue.class), + @JsonSubTypes.Type(LmntValue.class), + @JsonSubTypes.Type(NeetsValue.class), + @JsonSubTypes.Type(OpenaiValue.class), + @JsonSubTypes.Type(PlayhtValue.class), + @JsonSubTypes.Type(RimeAiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("azure") + private static final class AzureValue implements Value { + @JsonUnwrapped + private AzureVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AzureValue() {} + + private AzureValue(AzureVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAzure(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AzureValue && equalTo((AzureValue) other); + } + + private boolean equalTo(AzureValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("cartesia") + private static final class CartesiaValue implements Value { + @JsonUnwrapped + private CartesiaVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CartesiaValue() {} + + private CartesiaValue(CartesiaVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCartesia(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CartesiaValue && equalTo((CartesiaValue) other); + } + + private boolean equalTo(CartesiaValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("deepgram") + private static final class DeepgramValue implements Value { + @JsonUnwrapped + private DeepgramVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepgramValue() {} + + private DeepgramValue(DeepgramVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDeepgram(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepgramValue && equalTo((DeepgramValue) other); + } + + private boolean equalTo(DeepgramValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("11labs") + private static final class _11LabsValue implements Value { + @JsonUnwrapped + private ElevenLabsVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _11LabsValue() {} + + private _11LabsValue(ElevenLabsVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visit11Labs(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _11LabsValue && equalTo((_11LabsValue) other); + } + + private boolean equalTo(_11LabsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("lmnt") + private static final class LmntValue implements Value { + @JsonUnwrapped + private LmntVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private LmntValue() {} + + private LmntValue(LmntVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitLmnt(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LmntValue && equalTo((LmntValue) other); + } + + private boolean equalTo(LmntValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("neets") + private static final class NeetsValue implements Value { + @JsonUnwrapped + private NeetsVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NeetsValue() {} + + private NeetsValue(NeetsVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNeets(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NeetsValue && equalTo((NeetsValue) other); + } + + private boolean equalTo(NeetsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("openai") + private static final class OpenaiValue implements Value { + @JsonUnwrapped + private OpenAiVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenaiValue() {} + + private OpenaiValue(OpenAiVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOpenai(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenaiValue && equalTo((OpenaiValue) other); + } + + private boolean equalTo(OpenaiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("playht") + private static final class PlayhtValue implements Value { + @JsonUnwrapped + private PlayHtVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private PlayhtValue() {} + + private PlayhtValue(PlayHtVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitPlayht(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlayhtValue && equalTo((PlayhtValue) other); + } + + private boolean equalTo(PlayhtValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("rime-ai") + private static final class RimeAiValue implements Value { + @JsonUnwrapped + private RimeAiVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RimeAiValue() {} + + private RimeAiValue(RimeAiVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRimeAi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RimeAiValue && equalTo((RimeAiValue) other); + } + + private boolean equalTo(RimeAiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantVoice{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "AssistantVoice{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/AzureOpenAiCredential.java b/src/main/java/com/vapi/api/types/AzureOpenAiCredential.java new file mode 100644 index 0000000..ca0c03f --- /dev/null +++ b/src/main/java/com/vapi/api/types/AzureOpenAiCredential.java @@ -0,0 +1,348 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AzureOpenAiCredential.Builder.class) +public final class AzureOpenAiCredential { + private final AzureOpenAiCredentialRegion region; + + private final List models; + + private final String openAiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final String openAiEndpoint; + + private final Map additionalProperties; + + private AzureOpenAiCredential( + AzureOpenAiCredentialRegion region, + List models, + String openAiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + String openAiEndpoint, + Map additionalProperties) { + this.region = region; + this.models = models; + this.openAiKey = openAiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.openAiEndpoint = openAiEndpoint; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "azure-openai"; + } + + @JsonProperty("region") + public AzureOpenAiCredentialRegion getRegion() { + return region; + } + + @JsonProperty("models") + public List getModels() { + return models; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("openAIKey") + public String getOpenAiKey() { + return openAiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonProperty("openAIEndpoint") + public String getOpenAiEndpoint() { + return openAiEndpoint; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AzureOpenAiCredential && equalTo((AzureOpenAiCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AzureOpenAiCredential other) { + return region.equals(other.region) + && models.equals(other.models) + && openAiKey.equals(other.openAiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && openAiEndpoint.equals(other.openAiEndpoint); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.region, + this.models, + this.openAiKey, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.openAiEndpoint); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RegionStage builder() { + return new Builder(); + } + + public interface RegionStage { + OpenAiKeyStage region(@NotNull AzureOpenAiCredentialRegion region); + + Builder from(AzureOpenAiCredential other); + } + + public interface OpenAiKeyStage { + IdStage openAiKey(@NotNull String openAiKey); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + OpenAiEndpointStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface OpenAiEndpointStage { + _FinalStage openAiEndpoint(@NotNull String openAiEndpoint); + } + + public interface _FinalStage { + AzureOpenAiCredential build(); + + _FinalStage models(List models); + + _FinalStage addModels(AzureOpenAiCredentialModelsItem models); + + _FinalStage addAllModels(List models); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements RegionStage, + OpenAiKeyStage, + IdStage, + OrgIdStage, + CreatedAtStage, + UpdatedAtStage, + OpenAiEndpointStage, + _FinalStage { + private AzureOpenAiCredentialRegion region; + + private String openAiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private String openAiEndpoint; + + private List models = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AzureOpenAiCredential other) { + region(other.getRegion()); + models(other.getModels()); + openAiKey(other.getOpenAiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + openAiEndpoint(other.getOpenAiEndpoint()); + return this; + } + + @java.lang.Override + @JsonSetter("region") + public OpenAiKeyStage region(@NotNull AzureOpenAiCredentialRegion region) { + this.region = Objects.requireNonNull(region, "region must not be null"); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("openAIKey") + public IdStage openAiKey(@NotNull String openAiKey) { + this.openAiKey = Objects.requireNonNull(openAiKey, "openAiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public OpenAiEndpointStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("openAIEndpoint") + public _FinalStage openAiEndpoint(@NotNull String openAiEndpoint) { + this.openAiEndpoint = Objects.requireNonNull(openAiEndpoint, "openAiEndpoint must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllModels(List models) { + this.models.addAll(models); + return this; + } + + @java.lang.Override + public _FinalStage addModels(AzureOpenAiCredentialModelsItem models) { + this.models.add(models); + return this; + } + + @java.lang.Override + @JsonSetter(value = "models", nulls = Nulls.SKIP) + public _FinalStage models(List models) { + this.models.clear(); + this.models.addAll(models); + return this; + } + + @java.lang.Override + public AzureOpenAiCredential build() { + return new AzureOpenAiCredential( + region, models, openAiKey, id, orgId, createdAt, updatedAt, openAiEndpoint, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AzureOpenAiCredentialModelsItem.java b/src/main/java/com/vapi/api/types/AzureOpenAiCredentialModelsItem.java new file mode 100644 index 0000000..ecf58e9 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AzureOpenAiCredentialModelsItem.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AzureOpenAiCredentialModelsItem { + GPT_4_O_MINI_20240718("gpt-4o-mini-2024-07-18"), + + GPT_4_O_20240513("gpt-4o-2024-05-13"), + + GPT_4_TURBO_20240409("gpt-4-turbo-2024-04-09"), + + GPT_40125_PREVIEW("gpt-4-0125-preview"), + + GPT_41106_PREVIEW("gpt-4-1106-preview"), + + GPT_40613("gpt-4-0613"), + + GPT_35_TURBO_0125("gpt-35-turbo-0125"), + + GPT_35_TURBO_1106("gpt-35-turbo-1106"); + + private final String value; + + AzureOpenAiCredentialModelsItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/AzureOpenAiCredentialRegion.java b/src/main/java/com/vapi/api/types/AzureOpenAiCredentialRegion.java new file mode 100644 index 0000000..3ecbcff --- /dev/null +++ b/src/main/java/com/vapi/api/types/AzureOpenAiCredentialRegion.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AzureOpenAiCredentialRegion { + AUSTRALIA("australia"), + + CANADA("canada"), + + EASTUS_2("eastus2"), + + EASTUS("eastus"), + + FRANCE("france"), + + INDIA("india"), + + JAPAN("japan"), + + NORTHCENTRALUS("northcentralus"), + + NORWAY("norway"), + + SOUTHCENTRALUS("southcentralus"), + + SWEDEN("sweden"), + + SWITZERLAND("switzerland"), + + UK("uk"), + + WESTUS("westus"), + + WESTUS_3("westus3"); + + private final String value; + + AzureOpenAiCredentialRegion(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/AzureVoice.java b/src/main/java/com/vapi/api/types/AzureVoice.java new file mode 100644 index 0000000..1168f10 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AzureVoice.java @@ -0,0 +1,226 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AzureVoice.Builder.class) +public final class AzureVoice { + private final Optional fillerInjectionEnabled; + + private final AzureVoiceId voiceId; + + private final Optional speed; + + private final Optional chunkPlan; + + private final Map additionalProperties; + + private AzureVoice( + Optional fillerInjectionEnabled, + AzureVoiceId voiceId, + Optional speed, + Optional chunkPlan, + Map additionalProperties) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + this.voiceId = voiceId; + this.speed = speed; + this.chunkPlan = chunkPlan; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines whether fillers are injected into the model output before inputting it into the voice provider. + *

Default false because you can achieve better results with prompting the model.

+ */ + @JsonProperty("fillerInjectionEnabled") + public Optional getFillerInjectionEnabled() { + return fillerInjectionEnabled; + } + + /** + * @return This is the provider-specific ID that will be used. + */ + @JsonProperty("voiceId") + public AzureVoiceId getVoiceId() { + return voiceId; + } + + /** + * @return This is the speed multiplier that will be used. + */ + @JsonProperty("speed") + public Optional getSpeed() { + return speed; + } + + /** + * @return This is the plan for chunking the model output before it is sent to the voice provider. + */ + @JsonProperty("chunkPlan") + public Optional getChunkPlan() { + return chunkPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AzureVoice && equalTo((AzureVoice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AzureVoice other) { + return fillerInjectionEnabled.equals(other.fillerInjectionEnabled) + && voiceId.equals(other.voiceId) + && speed.equals(other.speed) + && chunkPlan.equals(other.chunkPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fillerInjectionEnabled, this.voiceId, this.speed, this.chunkPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VoiceIdStage builder() { + return new Builder(); + } + + public interface VoiceIdStage { + _FinalStage voiceId(@NotNull AzureVoiceId voiceId); + + Builder from(AzureVoice other); + } + + public interface _FinalStage { + AzureVoice build(); + + _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled); + + _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled); + + _FinalStage speed(Optional speed); + + _FinalStage speed(Double speed); + + _FinalStage chunkPlan(Optional chunkPlan); + + _FinalStage chunkPlan(ChunkPlan chunkPlan); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VoiceIdStage, _FinalStage { + private AzureVoiceId voiceId; + + private Optional chunkPlan = Optional.empty(); + + private Optional speed = Optional.empty(); + + private Optional fillerInjectionEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(AzureVoice other) { + fillerInjectionEnabled(other.getFillerInjectionEnabled()); + voiceId(other.getVoiceId()); + speed(other.getSpeed()); + chunkPlan(other.getChunkPlan()); + return this; + } + + /** + *

This is the provider-specific ID that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("voiceId") + public _FinalStage voiceId(@NotNull AzureVoiceId voiceId) { + this.voiceId = Objects.requireNonNull(voiceId, "voiceId must not be null"); + return this; + } + + /** + *

This is the plan for chunking the model output before it is sent to the voice provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage chunkPlan(ChunkPlan chunkPlan) { + this.chunkPlan = Optional.ofNullable(chunkPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "chunkPlan", nulls = Nulls.SKIP) + public _FinalStage chunkPlan(Optional chunkPlan) { + this.chunkPlan = chunkPlan; + return this; + } + + /** + *

This is the speed multiplier that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage speed(Double speed) { + this.speed = Optional.ofNullable(speed); + return this; + } + + @java.lang.Override + @JsonSetter(value = "speed", nulls = Nulls.SKIP) + public _FinalStage speed(Optional speed) { + this.speed = speed; + return this; + } + + /** + *

This determines whether fillers are injected into the model output before inputting it into the voice provider.

+ *

Default false because you can achieve better results with prompting the model.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled) { + this.fillerInjectionEnabled = Optional.ofNullable(fillerInjectionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fillerInjectionEnabled", nulls = Nulls.SKIP) + public _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + return this; + } + + @java.lang.Override + public AzureVoice build() { + return new AzureVoice(fillerInjectionEnabled, voiceId, speed, chunkPlan, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AzureVoiceId.java b/src/main/java/com/vapi/api/types/AzureVoiceId.java new file mode 100644 index 0000000..6ce17e0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AzureVoiceId.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.vapi.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = AzureVoiceId.Deserializer.class) +public final class AzureVoiceId { + private final Object value; + + private final int type; + + private AzureVoiceId(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((AzureVoiceIdEnum) this.value); + } else if (this.type == 1) { + return visitor.visit((String) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AzureVoiceId && equalTo((AzureVoiceId) other); + } + + private boolean equalTo(AzureVoiceId other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static AzureVoiceId of(AzureVoiceIdEnum value) { + return new AzureVoiceId(value, 0); + } + + public static AzureVoiceId of(String value) { + return new AzureVoiceId(value, 1); + } + + public interface Visitor { + T visit(AzureVoiceIdEnum value); + + T visit(String value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(AzureVoiceId.class); + } + + @java.lang.Override + public AzureVoiceId deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, AzureVoiceIdEnum.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (IllegalArgumentException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/vapi/api/types/AzureVoiceIdEnum.java b/src/main/java/com/vapi/api/types/AzureVoiceIdEnum.java new file mode 100644 index 0000000..23f9f20 --- /dev/null +++ b/src/main/java/com/vapi/api/types/AzureVoiceIdEnum.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AzureVoiceIdEnum { + ANDREW("andrew"), + + BRIAN("brian"), + + EMMA("emma"); + + private final String value; + + AzureVoiceIdEnum(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/BlockCompleteMessage.java b/src/main/java/com/vapi/api/types/BlockCompleteMessage.java new file mode 100644 index 0000000..d022004 --- /dev/null +++ b/src/main/java/com/vapi/api/types/BlockCompleteMessage.java @@ -0,0 +1,150 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BlockCompleteMessage.Builder.class) +public final class BlockCompleteMessage { + private final Optional> conditions; + + private final String content; + + private final Map additionalProperties; + + private BlockCompleteMessage( + Optional> conditions, + String content, + Map additionalProperties) { + this.conditions = conditions; + this.content = content; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is an optional array of conditions that must be met for this message to be triggered. + */ + @JsonProperty("conditions") + public Optional> getConditions() { + return conditions; + } + + /** + * @return This is the content that the assistant will say when this message is triggered. + */ + @JsonProperty("content") + public String getContent() { + return content; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockCompleteMessage && equalTo((BlockCompleteMessage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BlockCompleteMessage other) { + return conditions.equals(other.conditions) && content.equals(other.content); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.conditions, this.content); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ContentStage builder() { + return new Builder(); + } + + public interface ContentStage { + _FinalStage content(@NotNull String content); + + Builder from(BlockCompleteMessage other); + } + + public interface _FinalStage { + BlockCompleteMessage build(); + + _FinalStage conditions(Optional> conditions); + + _FinalStage conditions(List conditions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ContentStage, _FinalStage { + private String content; + + private Optional> conditions = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BlockCompleteMessage other) { + conditions(other.getConditions()); + content(other.getContent()); + return this; + } + + /** + *

This is the content that the assistant will say when this message is triggered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("content") + public _FinalStage content(@NotNull String content) { + this.content = Objects.requireNonNull(content, "content must not be null"); + return this; + } + + /** + *

This is an optional array of conditions that must be met for this message to be triggered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage conditions(List conditions) { + this.conditions = Optional.ofNullable(conditions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "conditions", nulls = Nulls.SKIP) + public _FinalStage conditions(Optional> conditions) { + this.conditions = conditions; + return this; + } + + @java.lang.Override + public BlockCompleteMessage build() { + return new BlockCompleteMessage(conditions, content, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/BlockCompleteMessageConditionsItem.java b/src/main/java/com/vapi/api/types/BlockCompleteMessageConditionsItem.java new file mode 100644 index 0000000..97268db --- /dev/null +++ b/src/main/java/com/vapi/api/types/BlockCompleteMessageConditionsItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class BlockCompleteMessageConditionsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private BlockCompleteMessageConditionsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static BlockCompleteMessageConditionsItem modelBased(ModelBasedCondition value) { + return new BlockCompleteMessageConditionsItem(new ModelBasedValue(value)); + } + + public static BlockCompleteMessageConditionsItem ruleBased(RuleBasedCondition value) { + return new BlockCompleteMessageConditionsItem(new RuleBasedValue(value)); + } + + public boolean isModelBased() { + return value instanceof ModelBasedValue; + } + + public boolean isRuleBased() { + return value instanceof RuleBasedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getModelBased() { + if (isModelBased()) { + return Optional.of(((ModelBasedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRuleBased() { + if (isRuleBased()) { + return Optional.of(((RuleBasedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitModelBased(ModelBasedCondition modelBased); + + T visitRuleBased(RuleBasedCondition ruleBased); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(ModelBasedValue.class), @JsonSubTypes.Type(RuleBasedValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("model-based") + private static final class ModelBasedValue implements Value { + @JsonUnwrapped + private ModelBasedCondition value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ModelBasedValue() {} + + private ModelBasedValue(ModelBasedCondition value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitModelBased(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ModelBasedValue && equalTo((ModelBasedValue) other); + } + + private boolean equalTo(ModelBasedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlockCompleteMessageConditionsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("rule-based") + private static final class RuleBasedValue implements Value { + @JsonUnwrapped + private RuleBasedCondition value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RuleBasedValue() {} + + private RuleBasedValue(RuleBasedCondition value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRuleBased(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RuleBasedValue && equalTo((RuleBasedValue) other); + } + + private boolean equalTo(RuleBasedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlockCompleteMessageConditionsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "BlockCompleteMessageConditionsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/BlockStartMessage.java b/src/main/java/com/vapi/api/types/BlockStartMessage.java new file mode 100644 index 0000000..b48dd93 --- /dev/null +++ b/src/main/java/com/vapi/api/types/BlockStartMessage.java @@ -0,0 +1,150 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BlockStartMessage.Builder.class) +public final class BlockStartMessage { + private final Optional> conditions; + + private final String content; + + private final Map additionalProperties; + + private BlockStartMessage( + Optional> conditions, + String content, + Map additionalProperties) { + this.conditions = conditions; + this.content = content; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is an optional array of conditions that must be met for this message to be triggered. + */ + @JsonProperty("conditions") + public Optional> getConditions() { + return conditions; + } + + /** + * @return This is the content that the assistant will say when this message is triggered. + */ + @JsonProperty("content") + public String getContent() { + return content; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockStartMessage && equalTo((BlockStartMessage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BlockStartMessage other) { + return conditions.equals(other.conditions) && content.equals(other.content); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.conditions, this.content); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ContentStage builder() { + return new Builder(); + } + + public interface ContentStage { + _FinalStage content(@NotNull String content); + + Builder from(BlockStartMessage other); + } + + public interface _FinalStage { + BlockStartMessage build(); + + _FinalStage conditions(Optional> conditions); + + _FinalStage conditions(List conditions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ContentStage, _FinalStage { + private String content; + + private Optional> conditions = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BlockStartMessage other) { + conditions(other.getConditions()); + content(other.getContent()); + return this; + } + + /** + *

This is the content that the assistant will say when this message is triggered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("content") + public _FinalStage content(@NotNull String content) { + this.content = Objects.requireNonNull(content, "content must not be null"); + return this; + } + + /** + *

This is an optional array of conditions that must be met for this message to be triggered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage conditions(List conditions) { + this.conditions = Optional.ofNullable(conditions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "conditions", nulls = Nulls.SKIP) + public _FinalStage conditions(Optional> conditions) { + this.conditions = conditions; + return this; + } + + @java.lang.Override + public BlockStartMessage build() { + return new BlockStartMessage(conditions, content, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/BlockStartMessageConditionsItem.java b/src/main/java/com/vapi/api/types/BlockStartMessageConditionsItem.java new file mode 100644 index 0000000..2e0ba49 --- /dev/null +++ b/src/main/java/com/vapi/api/types/BlockStartMessageConditionsItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class BlockStartMessageConditionsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private BlockStartMessageConditionsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static BlockStartMessageConditionsItem modelBased(ModelBasedCondition value) { + return new BlockStartMessageConditionsItem(new ModelBasedValue(value)); + } + + public static BlockStartMessageConditionsItem ruleBased(RuleBasedCondition value) { + return new BlockStartMessageConditionsItem(new RuleBasedValue(value)); + } + + public boolean isModelBased() { + return value instanceof ModelBasedValue; + } + + public boolean isRuleBased() { + return value instanceof RuleBasedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getModelBased() { + if (isModelBased()) { + return Optional.of(((ModelBasedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRuleBased() { + if (isRuleBased()) { + return Optional.of(((RuleBasedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitModelBased(ModelBasedCondition modelBased); + + T visitRuleBased(RuleBasedCondition ruleBased); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(ModelBasedValue.class), @JsonSubTypes.Type(RuleBasedValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("model-based") + private static final class ModelBasedValue implements Value { + @JsonUnwrapped + private ModelBasedCondition value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ModelBasedValue() {} + + private ModelBasedValue(ModelBasedCondition value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitModelBased(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ModelBasedValue && equalTo((ModelBasedValue) other); + } + + private boolean equalTo(ModelBasedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlockStartMessageConditionsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("rule-based") + private static final class RuleBasedValue implements Value { + @JsonUnwrapped + private RuleBasedCondition value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RuleBasedValue() {} + + private RuleBasedValue(RuleBasedCondition value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRuleBased(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RuleBasedValue && equalTo((RuleBasedValue) other); + } + + private boolean equalTo(RuleBasedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BlockStartMessageConditionsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "BlockStartMessageConditionsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/BotMessage.java b/src/main/java/com/vapi/api/types/BotMessage.java new file mode 100644 index 0000000..2a32b41 --- /dev/null +++ b/src/main/java/com/vapi/api/types/BotMessage.java @@ -0,0 +1,314 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BotMessage.Builder.class) +public final class BotMessage { + private final String role; + + private final String message; + + private final double time; + + private final double endTime; + + private final double secondsFromStart; + + private final Optional source; + + private final Optional duration; + + private final Map additionalProperties; + + private BotMessage( + String role, + String message, + double time, + double endTime, + double secondsFromStart, + Optional source, + Optional duration, + Map additionalProperties) { + this.role = role; + this.message = message; + this.time = time; + this.endTime = endTime; + this.secondsFromStart = secondsFromStart; + this.source = source; + this.duration = duration; + this.additionalProperties = additionalProperties; + } + + /** + * @return The role of the bot in the conversation. + */ + @JsonProperty("role") + public String getRole() { + return role; + } + + /** + * @return The message content from the bot. + */ + @JsonProperty("message") + public String getMessage() { + return message; + } + + /** + * @return The timestamp when the message was sent. + */ + @JsonProperty("time") + public double getTime() { + return time; + } + + /** + * @return The timestamp when the message ended. + */ + @JsonProperty("endTime") + public double getEndTime() { + return endTime; + } + + /** + * @return The number of seconds from the start of the conversation. + */ + @JsonProperty("secondsFromStart") + public double getSecondsFromStart() { + return secondsFromStart; + } + + /** + * @return The source of the message. + */ + @JsonProperty("source") + public Optional getSource() { + return source; + } + + /** + * @return The duration of the message in seconds. + */ + @JsonProperty("duration") + public Optional getDuration() { + return duration; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BotMessage && equalTo((BotMessage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BotMessage other) { + return role.equals(other.role) + && message.equals(other.message) + && time == other.time + && endTime == other.endTime + && secondsFromStart == other.secondsFromStart + && source.equals(other.source) + && duration.equals(other.duration); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.role, this.message, this.time, this.endTime, this.secondsFromStart, this.source, this.duration); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RoleStage builder() { + return new Builder(); + } + + public interface RoleStage { + MessageStage role(@NotNull String role); + + Builder from(BotMessage other); + } + + public interface MessageStage { + TimeStage message(@NotNull String message); + } + + public interface TimeStage { + EndTimeStage time(double time); + } + + public interface EndTimeStage { + SecondsFromStartStage endTime(double endTime); + } + + public interface SecondsFromStartStage { + _FinalStage secondsFromStart(double secondsFromStart); + } + + public interface _FinalStage { + BotMessage build(); + + _FinalStage source(Optional source); + + _FinalStage source(String source); + + _FinalStage duration(Optional duration); + + _FinalStage duration(Double duration); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements RoleStage, MessageStage, TimeStage, EndTimeStage, SecondsFromStartStage, _FinalStage { + private String role; + + private String message; + + private double time; + + private double endTime; + + private double secondsFromStart; + + private Optional duration = Optional.empty(); + + private Optional source = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BotMessage other) { + role(other.getRole()); + message(other.getMessage()); + time(other.getTime()); + endTime(other.getEndTime()); + secondsFromStart(other.getSecondsFromStart()); + source(other.getSource()); + duration(other.getDuration()); + return this; + } + + /** + *

The role of the bot in the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("role") + public MessageStage role(@NotNull String role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + /** + *

The message content from the bot.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message") + public TimeStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + /** + *

The timestamp when the message was sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("time") + public EndTimeStage time(double time) { + this.time = time; + return this; + } + + /** + *

The timestamp when the message ended.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("endTime") + public SecondsFromStartStage endTime(double endTime) { + this.endTime = endTime; + return this; + } + + /** + *

The number of seconds from the start of the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("secondsFromStart") + public _FinalStage secondsFromStart(double secondsFromStart) { + this.secondsFromStart = secondsFromStart; + return this; + } + + /** + *

The duration of the message in seconds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage duration(Double duration) { + this.duration = Optional.ofNullable(duration); + return this; + } + + @java.lang.Override + @JsonSetter(value = "duration", nulls = Nulls.SKIP) + public _FinalStage duration(Optional duration) { + this.duration = duration; + return this; + } + + /** + *

The source of the message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage source(String source) { + this.source = Optional.ofNullable(source); + return this; + } + + @java.lang.Override + @JsonSetter(value = "source", nulls = Nulls.SKIP) + public _FinalStage source(Optional source) { + this.source = source; + return this; + } + + @java.lang.Override + public BotMessage build() { + return new BotMessage( + role, message, time, endTime, secondsFromStart, source, duration, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/BucketPlan.java b/src/main/java/com/vapi/api/types/BucketPlan.java new file mode 100644 index 0000000..b4a85ca --- /dev/null +++ b/src/main/java/com/vapi/api/types/BucketPlan.java @@ -0,0 +1,305 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BucketPlan.Builder.class) +public final class BucketPlan { + private final String name; + + private final Optional region; + + private final Optional path; + + private final Optional hmacAccessKey; + + private final Optional hmacSecret; + + private final Map additionalProperties; + + private BucketPlan( + String name, + Optional region, + Optional path, + Optional hmacAccessKey, + Optional hmacSecret, + Map additionalProperties) { + this.name = name; + this.region = region; + this.path = path; + this.hmacAccessKey = hmacAccessKey; + this.hmacSecret = hmacSecret; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the name of the bucket. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return This is the region of the bucket. + *

Usage:

+ *
    + *
  • If credential.type is aws, then this is required.
  • + *
  • If credential.type is gcp, then this is optional since GCP allows buckets to be accessed without a region but region is required for data residency requirements. Read here: https://cloud.google.com/storage/docs/request-endpoints
  • + *
+ */ + @JsonProperty("region") + public Optional getRegion() { + return region; + } + + /** + * @return This is the path where call artifacts will be stored. + *

Usage:

+ *
    + *
  • To store call artifacts in a specific folder, set this to the full path. Eg. "/folder-name1/folder-name2".
  • + *
  • To store call artifacts in the root of the bucket, leave this blank.
  • + *
+ *

@default "/"

+ */ + @JsonProperty("path") + public Optional getPath() { + return path; + } + + /** + * @return This is the HMAC access key offered by GCP for interoperability with S3 clients. Here is the guide on how to create: https://cloud.google.com/storage/docs/authentication/managing-hmackeys#console + *

Usage:

+ *
    + *
  • If credential.type is gcp, then this is required.
  • + *
  • If credential.type is aws, then this is not required since credential.awsAccessKeyId is used instead.
  • + *
+ */ + @JsonProperty("hmacAccessKey") + public Optional getHmacAccessKey() { + return hmacAccessKey; + } + + /** + * @return This is the secret for the HMAC access key. Here is the guide on how to create: https://cloud.google.com/storage/docs/authentication/managing-hmackeys#console + *

Usage:

+ *
    + *
  • If credential.type is gcp, then this is required.
  • + *
  • If credential.type is aws, then this is not required since credential.awsSecretAccessKey is used instead.
  • + *
+ *

Note: This is not returned in the API.

+ */ + @JsonProperty("hmacSecret") + public Optional getHmacSecret() { + return hmacSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BucketPlan && equalTo((BucketPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BucketPlan other) { + return name.equals(other.name) + && region.equals(other.region) + && path.equals(other.path) + && hmacAccessKey.equals(other.hmacAccessKey) + && hmacSecret.equals(other.hmacSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.region, this.path, this.hmacAccessKey, this.hmacSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + + Builder from(BucketPlan other); + } + + public interface _FinalStage { + BucketPlan build(); + + _FinalStage region(Optional region); + + _FinalStage region(String region); + + _FinalStage path(Optional path); + + _FinalStage path(String path); + + _FinalStage hmacAccessKey(Optional hmacAccessKey); + + _FinalStage hmacAccessKey(String hmacAccessKey); + + _FinalStage hmacSecret(Optional hmacSecret); + + _FinalStage hmacSecret(String hmacSecret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + private Optional hmacSecret = Optional.empty(); + + private Optional hmacAccessKey = Optional.empty(); + + private Optional path = Optional.empty(); + + private Optional region = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BucketPlan other) { + name(other.getName()); + region(other.getRegion()); + path(other.getPath()); + hmacAccessKey(other.getHmacAccessKey()); + hmacSecret(other.getHmacSecret()); + return this; + } + + /** + *

This is the name of the bucket.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

This is the secret for the HMAC access key. Here is the guide on how to create: https://cloud.google.com/storage/docs/authentication/managing-hmackeys#console

+ *

Usage:

+ *
    + *
  • If credential.type is gcp, then this is required.
  • + *
  • If credential.type is aws, then this is not required since credential.awsSecretAccessKey is used instead.
  • + *
+ *

Note: This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hmacSecret(String hmacSecret) { + this.hmacSecret = Optional.ofNullable(hmacSecret); + return this; + } + + @java.lang.Override + @JsonSetter(value = "hmacSecret", nulls = Nulls.SKIP) + public _FinalStage hmacSecret(Optional hmacSecret) { + this.hmacSecret = hmacSecret; + return this; + } + + /** + *

This is the HMAC access key offered by GCP for interoperability with S3 clients. Here is the guide on how to create: https://cloud.google.com/storage/docs/authentication/managing-hmackeys#console

+ *

Usage:

+ *
    + *
  • If credential.type is gcp, then this is required.
  • + *
  • If credential.type is aws, then this is not required since credential.awsAccessKeyId is used instead.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hmacAccessKey(String hmacAccessKey) { + this.hmacAccessKey = Optional.ofNullable(hmacAccessKey); + return this; + } + + @java.lang.Override + @JsonSetter(value = "hmacAccessKey", nulls = Nulls.SKIP) + public _FinalStage hmacAccessKey(Optional hmacAccessKey) { + this.hmacAccessKey = hmacAccessKey; + return this; + } + + /** + *

This is the path where call artifacts will be stored.

+ *

Usage:

+ *
    + *
  • To store call artifacts in a specific folder, set this to the full path. Eg. "/folder-name1/folder-name2".
  • + *
  • To store call artifacts in the root of the bucket, leave this blank.
  • + *
+ *

@default "/"

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage path(String path) { + this.path = Optional.ofNullable(path); + return this; + } + + @java.lang.Override + @JsonSetter(value = "path", nulls = Nulls.SKIP) + public _FinalStage path(Optional path) { + this.path = path; + return this; + } + + /** + *

This is the region of the bucket.

+ *

Usage:

+ *
    + *
  • If credential.type is aws, then this is required.
  • + *
  • If credential.type is gcp, then this is optional since GCP allows buckets to be accessed without a region but region is required for data residency requirements. Read here: https://cloud.google.com/storage/docs/request-endpoints
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage region(String region) { + this.region = Optional.ofNullable(region); + return this; + } + + @java.lang.Override + @JsonSetter(value = "region", nulls = Nulls.SKIP) + public _FinalStage region(Optional region) { + this.region = region; + return this; + } + + @java.lang.Override + public BucketPlan build() { + return new BucketPlan(name, region, path, hmacAccessKey, hmacSecret, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/BuyPhoneNumberDto.java b/src/main/java/com/vapi/api/types/BuyPhoneNumberDto.java new file mode 100644 index 0000000..86a4643 --- /dev/null +++ b/src/main/java/com/vapi/api/types/BuyPhoneNumberDto.java @@ -0,0 +1,372 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BuyPhoneNumberDto.Builder.class) +public final class BuyPhoneNumberDto { + private final Optional fallbackDestination; + + private final String areaCode; + + private final Optional name; + + private final Optional assistantId; + + private final Optional squadId; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Map additionalProperties; + + private BuyPhoneNumberDto( + Optional fallbackDestination, + String areaCode, + Optional name, + Optional assistantId, + Optional squadId, + Optional serverUrl, + Optional serverUrlSecret, + Map additionalProperties) { + this.fallbackDestination = fallbackDestination; + this.areaCode = areaCode; + this.name = name; + this.assistantId = assistantId; + this.squadId = squadId; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the fallback destination an inbound call will be transferred to if: + *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ */ + @JsonProperty("fallbackDestination") + public Optional getFallbackDestination() { + return fallbackDestination; + } + + /** + * @return This is the area code of the phone number to purchase. + */ + @JsonProperty("areaCode") + public String getAreaCode() { + return areaCode; + } + + /** + * @return This is the name of the phone number. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the assistant that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the squad that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message. + *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BuyPhoneNumberDto && equalTo((BuyPhoneNumberDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BuyPhoneNumberDto other) { + return fallbackDestination.equals(other.fallbackDestination) + && areaCode.equals(other.areaCode) + && name.equals(other.name) + && assistantId.equals(other.assistantId) + && squadId.equals(other.squadId) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fallbackDestination, + this.areaCode, + this.name, + this.assistantId, + this.squadId, + this.serverUrl, + this.serverUrlSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AreaCodeStage builder() { + return new Builder(); + } + + public interface AreaCodeStage { + _FinalStage areaCode(@NotNull String areaCode); + + Builder from(BuyPhoneNumberDto other); + } + + public interface _FinalStage { + BuyPhoneNumberDto build(); + + _FinalStage fallbackDestination(Optional fallbackDestination); + + _FinalStage fallbackDestination(BuyPhoneNumberDtoFallbackDestination fallbackDestination); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage assistantId(Optional assistantId); + + _FinalStage assistantId(String assistantId); + + _FinalStage squadId(Optional squadId); + + _FinalStage squadId(String squadId); + + _FinalStage serverUrl(Optional serverUrl); + + _FinalStage serverUrl(String serverUrl); + + _FinalStage serverUrlSecret(Optional serverUrlSecret); + + _FinalStage serverUrlSecret(String serverUrlSecret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AreaCodeStage, _FinalStage { + private String areaCode; + + private Optional serverUrlSecret = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional fallbackDestination = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(BuyPhoneNumberDto other) { + fallbackDestination(other.getFallbackDestination()); + areaCode(other.getAreaCode()); + name(other.getName()); + assistantId(other.getAssistantId()); + squadId(other.getSquadId()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + return this; + } + + /** + *

This is the area code of the phone number to purchase.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("areaCode") + public _FinalStage areaCode(@NotNull String areaCode) { + this.areaCode = Objects.requireNonNull(areaCode, "areaCode must not be null"); + return this; + } + + /** + *

This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret.

+ *

Same precedence logic as serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public _FinalStage serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + /** + *

This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message.

+ *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public _FinalStage serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + /** + *

This is the squad that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public _FinalStage squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + /** + *

This is the assistant that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public _FinalStage assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + /** + *

This is the name of the phone number. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the fallback destination an inbound call will be transferred to if:

+ *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fallbackDestination(BuyPhoneNumberDtoFallbackDestination fallbackDestination) { + this.fallbackDestination = Optional.ofNullable(fallbackDestination); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fallbackDestination", nulls = Nulls.SKIP) + public _FinalStage fallbackDestination(Optional fallbackDestination) { + this.fallbackDestination = fallbackDestination; + return this; + } + + @java.lang.Override + public BuyPhoneNumberDto build() { + return new BuyPhoneNumberDto( + fallbackDestination, + areaCode, + name, + assistantId, + squadId, + serverUrl, + serverUrlSecret, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/BuyPhoneNumberDtoFallbackDestination.java b/src/main/java/com/vapi/api/types/BuyPhoneNumberDtoFallbackDestination.java new file mode 100644 index 0000000..b66ea2b --- /dev/null +++ b/src/main/java/com/vapi/api/types/BuyPhoneNumberDtoFallbackDestination.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class BuyPhoneNumberDtoFallbackDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private BuyPhoneNumberDtoFallbackDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static BuyPhoneNumberDtoFallbackDestination number(TransferDestinationNumber value) { + return new BuyPhoneNumberDtoFallbackDestination(new NumberValue(value)); + } + + public static BuyPhoneNumberDtoFallbackDestination sip(TransferDestinationSip value) { + return new BuyPhoneNumberDtoFallbackDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BuyPhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "BuyPhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "BuyPhoneNumberDtoFallbackDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ByoPhoneNumber.java b/src/main/java/com/vapi/api/types/ByoPhoneNumber.java new file mode 100644 index 0000000..76b50a9 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ByoPhoneNumber.java @@ -0,0 +1,600 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ByoPhoneNumber.Builder.class) +public final class ByoPhoneNumber { + private final Optional fallbackDestination; + + private final Optional numberE164CheckEnabled; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional name; + + private final Optional assistantId; + + private final Optional squadId; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Optional number; + + private final String credentialId; + + private final Map additionalProperties; + + private ByoPhoneNumber( + Optional fallbackDestination, + Optional numberE164CheckEnabled, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional name, + Optional assistantId, + Optional squadId, + Optional serverUrl, + Optional serverUrlSecret, + Optional number, + String credentialId, + Map additionalProperties) { + this.fallbackDestination = fallbackDestination; + this.numberE164CheckEnabled = numberE164CheckEnabled; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.name = name; + this.assistantId = assistantId; + this.squadId = squadId; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.number = number; + this.credentialId = credentialId; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the fallback destination an inbound call will be transferred to if: + *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ */ + @JsonProperty("fallbackDestination") + public Optional getFallbackDestination() { + return fallbackDestination; + } + + /** + * @return This is the flag to toggle the E164 check for the number field. This is an advanced property which should be used if you know your use case requires it. + *

Use cases:

+ *
    + *
  • false: To allow non-E164 numbers like +001234567890, 1234, or abc. This is useful for dialing out to non-E164 numbers on your SIP trunks.
  • + *
  • true (default): To allow only E164 numbers like +14155551234. This is standard for PSTN calls.
  • + *
+ *

If false, the number is still required to only contain alphanumeric characters (regex: /^\+?[a-zA-Z0-9]+$/).

+ *

@default true (E164 check is enabled)

+ */ + @JsonProperty("numberE164CheckEnabled") + public Optional getNumberE164CheckEnabled() { + return numberE164CheckEnabled; + } + + /** + * @return This is the unique identifier for the phone number. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this phone number belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the phone number was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the phone number was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the name of the phone number. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the assistant that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the squad that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message. + *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + /** + * @return This is the number of the customer. + */ + @JsonProperty("number") + public Optional getNumber() { + return number; + } + + /** + * @return This is the credential of your own SIP trunk or Carrier (type byo-sip-trunk) which can be used to make calls to this phone number. + *

You can add the SIP trunk or Carrier credential in the Provider Credentials page on the Dashboard to get the credentialId.

+ */ + @JsonProperty("credentialId") + public String getCredentialId() { + return credentialId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumber && equalTo((ByoPhoneNumber) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ByoPhoneNumber other) { + return fallbackDestination.equals(other.fallbackDestination) + && numberE164CheckEnabled.equals(other.numberE164CheckEnabled) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && name.equals(other.name) + && assistantId.equals(other.assistantId) + && squadId.equals(other.squadId) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret) + && number.equals(other.number) + && credentialId.equals(other.credentialId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fallbackDestination, + this.numberE164CheckEnabled, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.name, + this.assistantId, + this.squadId, + this.serverUrl, + this.serverUrlSecret, + this.number, + this.credentialId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(ByoPhoneNumber other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + CredentialIdStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface CredentialIdStage { + _FinalStage credentialId(@NotNull String credentialId); + } + + public interface _FinalStage { + ByoPhoneNumber build(); + + _FinalStage fallbackDestination(Optional fallbackDestination); + + _FinalStage fallbackDestination(ByoPhoneNumberFallbackDestination fallbackDestination); + + _FinalStage numberE164CheckEnabled(Optional numberE164CheckEnabled); + + _FinalStage numberE164CheckEnabled(Boolean numberE164CheckEnabled); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage assistantId(Optional assistantId); + + _FinalStage assistantId(String assistantId); + + _FinalStage squadId(Optional squadId); + + _FinalStage squadId(String squadId); + + _FinalStage serverUrl(Optional serverUrl); + + _FinalStage serverUrl(String serverUrl); + + _FinalStage serverUrlSecret(Optional serverUrlSecret); + + _FinalStage serverUrlSecret(String serverUrlSecret); + + _FinalStage number(Optional number); + + _FinalStage number(String number); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, CredentialIdStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private String credentialId; + + private Optional number = Optional.empty(); + + private Optional serverUrlSecret = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional numberE164CheckEnabled = Optional.empty(); + + private Optional fallbackDestination = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ByoPhoneNumber other) { + fallbackDestination(other.getFallbackDestination()); + numberE164CheckEnabled(other.getNumberE164CheckEnabled()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + name(other.getName()); + assistantId(other.getAssistantId()); + squadId(other.getSquadId()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + number(other.getNumber()); + credentialId(other.getCredentialId()); + return this; + } + + /** + *

This is the unique identifier for the phone number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this phone number belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the phone number was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the phone number was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public CredentialIdStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the credential of your own SIP trunk or Carrier (type byo-sip-trunk) which can be used to make calls to this phone number.

+ *

You can add the SIP trunk or Carrier credential in the Provider Credentials page on the Dashboard to get the credentialId.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("credentialId") + public _FinalStage credentialId(@NotNull String credentialId) { + this.credentialId = Objects.requireNonNull(credentialId, "credentialId must not be null"); + return this; + } + + /** + *

This is the number of the customer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage number(String number) { + this.number = Optional.ofNullable(number); + return this; + } + + @java.lang.Override + @JsonSetter(value = "number", nulls = Nulls.SKIP) + public _FinalStage number(Optional number) { + this.number = number; + return this; + } + + /** + *

This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret.

+ *

Same precedence logic as serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public _FinalStage serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + /** + *

This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message.

+ *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public _FinalStage serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + /** + *

This is the squad that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public _FinalStage squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + /** + *

This is the assistant that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public _FinalStage assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + /** + *

This is the name of the phone number. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the flag to toggle the E164 check for the number field. This is an advanced property which should be used if you know your use case requires it.

+ *

Use cases:

+ *
    + *
  • false: To allow non-E164 numbers like +001234567890, 1234, or abc. This is useful for dialing out to non-E164 numbers on your SIP trunks.
  • + *
  • true (default): To allow only E164 numbers like +14155551234. This is standard for PSTN calls.
  • + *
+ *

If false, the number is still required to only contain alphanumeric characters (regex: /^\+?[a-zA-Z0-9]+$/).

+ *

@default true (E164 check is enabled)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numberE164CheckEnabled(Boolean numberE164CheckEnabled) { + this.numberE164CheckEnabled = Optional.ofNullable(numberE164CheckEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "numberE164CheckEnabled", nulls = Nulls.SKIP) + public _FinalStage numberE164CheckEnabled(Optional numberE164CheckEnabled) { + this.numberE164CheckEnabled = numberE164CheckEnabled; + return this; + } + + /** + *

This is the fallback destination an inbound call will be transferred to if:

+ *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fallbackDestination(ByoPhoneNumberFallbackDestination fallbackDestination) { + this.fallbackDestination = Optional.ofNullable(fallbackDestination); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fallbackDestination", nulls = Nulls.SKIP) + public _FinalStage fallbackDestination(Optional fallbackDestination) { + this.fallbackDestination = fallbackDestination; + return this; + } + + @java.lang.Override + public ByoPhoneNumber build() { + return new ByoPhoneNumber( + fallbackDestination, + numberE164CheckEnabled, + id, + orgId, + createdAt, + updatedAt, + name, + assistantId, + squadId, + serverUrl, + serverUrlSecret, + number, + credentialId, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ByoPhoneNumberFallbackDestination.java b/src/main/java/com/vapi/api/types/ByoPhoneNumberFallbackDestination.java new file mode 100644 index 0000000..3843a49 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ByoPhoneNumberFallbackDestination.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ByoPhoneNumberFallbackDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ByoPhoneNumberFallbackDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ByoPhoneNumberFallbackDestination number(TransferDestinationNumber value) { + return new ByoPhoneNumberFallbackDestination(new NumberValue(value)); + } + + public static ByoPhoneNumberFallbackDestination sip(TransferDestinationSip value) { + return new ByoPhoneNumberFallbackDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ByoPhoneNumberFallbackDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ByoPhoneNumberFallbackDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ByoPhoneNumberFallbackDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ByoSipTrunkCredential.java b/src/main/java/com/vapi/api/types/ByoSipTrunkCredential.java new file mode 100644 index 0000000..582f4b0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ByoSipTrunkCredential.java @@ -0,0 +1,476 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ByoSipTrunkCredential.Builder.class) +public final class ByoSipTrunkCredential { + private final Optional provider; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final List gateways; + + private final Optional name; + + private final Optional outboundAuthenticationPlan; + + private final Optional outboundLeadingPlusEnabled; + + private final Optional sbcConfiguration; + + private final Map additionalProperties; + + private ByoSipTrunkCredential( + Optional provider, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + List gateways, + Optional name, + Optional outboundAuthenticationPlan, + Optional outboundLeadingPlusEnabled, + Optional sbcConfiguration, + Map additionalProperties) { + this.provider = provider; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.gateways = gateways; + this.name = name; + this.outboundAuthenticationPlan = outboundAuthenticationPlan; + this.outboundLeadingPlusEnabled = outboundLeadingPlusEnabled; + this.sbcConfiguration = sbcConfiguration; + this.additionalProperties = additionalProperties; + } + + /** + * @return This can be used to bring your own SIP trunks or to connect to a Carrier. + */ + @JsonProperty("provider") + public Optional getProvider() { + return provider; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the list of SIP trunk's gateways. + */ + @JsonProperty("gateways") + public List getGateways() { + return gateways; + } + + /** + * @return This is the name of the SIP trunk. This is just for your reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This can be used to configure the outbound authentication if required by the SIP trunk. + */ + @JsonProperty("outboundAuthenticationPlan") + public Optional getOutboundAuthenticationPlan() { + return outboundAuthenticationPlan; + } + + /** + * @return This ensures the outbound origination attempts have a leading plus. Defaults to false to match conventional telecom behavior. + *

Usage:

+ *
    + *
  • Vonage/Twilio requires leading plus for all outbound calls. Set this to true.
  • + *
+ *

@default false

+ */ + @JsonProperty("outboundLeadingPlusEnabled") + public Optional getOutboundLeadingPlusEnabled() { + return outboundLeadingPlusEnabled; + } + + /** + * @return This is an advanced configuration for enterprise deployments. This uses the onprem SBC to trunk into the SIP trunk's gateways, rather than the managed SBC provided by Vapi. + */ + @JsonProperty("sbcConfiguration") + public Optional getSbcConfiguration() { + return sbcConfiguration; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoSipTrunkCredential && equalTo((ByoSipTrunkCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ByoSipTrunkCredential other) { + return provider.equals(other.provider) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && gateways.equals(other.gateways) + && name.equals(other.name) + && outboundAuthenticationPlan.equals(other.outboundAuthenticationPlan) + && outboundLeadingPlusEnabled.equals(other.outboundLeadingPlusEnabled) + && sbcConfiguration.equals(other.sbcConfiguration); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.provider, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.gateways, + this.name, + this.outboundAuthenticationPlan, + this.outboundLeadingPlusEnabled, + this.sbcConfiguration); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(ByoSipTrunkCredential other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + ByoSipTrunkCredential build(); + + _FinalStage provider(Optional provider); + + _FinalStage provider(String provider); + + _FinalStage gateways(List gateways); + + _FinalStage addGateways(SipTrunkGateway gateways); + + _FinalStage addAllGateways(List gateways); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage outboundAuthenticationPlan(Optional outboundAuthenticationPlan); + + _FinalStage outboundAuthenticationPlan(SipTrunkOutboundAuthenticationPlan outboundAuthenticationPlan); + + _FinalStage outboundLeadingPlusEnabled(Optional outboundLeadingPlusEnabled); + + _FinalStage outboundLeadingPlusEnabled(Boolean outboundLeadingPlusEnabled); + + _FinalStage sbcConfiguration(Optional sbcConfiguration); + + _FinalStage sbcConfiguration(SbcConfiguration sbcConfiguration); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional sbcConfiguration = Optional.empty(); + + private Optional outboundLeadingPlusEnabled = Optional.empty(); + + private Optional outboundAuthenticationPlan = Optional.empty(); + + private Optional name = Optional.empty(); + + private List gateways = new ArrayList<>(); + + private Optional provider = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ByoSipTrunkCredential other) { + provider(other.getProvider()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + gateways(other.getGateways()); + name(other.getName()); + outboundAuthenticationPlan(other.getOutboundAuthenticationPlan()); + outboundLeadingPlusEnabled(other.getOutboundLeadingPlusEnabled()); + sbcConfiguration(other.getSbcConfiguration()); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is an advanced configuration for enterprise deployments. This uses the onprem SBC to trunk into the SIP trunk's gateways, rather than the managed SBC provided by Vapi.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage sbcConfiguration(SbcConfiguration sbcConfiguration) { + this.sbcConfiguration = Optional.ofNullable(sbcConfiguration); + return this; + } + + @java.lang.Override + @JsonSetter(value = "sbcConfiguration", nulls = Nulls.SKIP) + public _FinalStage sbcConfiguration(Optional sbcConfiguration) { + this.sbcConfiguration = sbcConfiguration; + return this; + } + + /** + *

This ensures the outbound origination attempts have a leading plus. Defaults to false to match conventional telecom behavior.

+ *

Usage:

+ *
    + *
  • Vonage/Twilio requires leading plus for all outbound calls. Set this to true.
  • + *
+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage outboundLeadingPlusEnabled(Boolean outboundLeadingPlusEnabled) { + this.outboundLeadingPlusEnabled = Optional.ofNullable(outboundLeadingPlusEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "outboundLeadingPlusEnabled", nulls = Nulls.SKIP) + public _FinalStage outboundLeadingPlusEnabled(Optional outboundLeadingPlusEnabled) { + this.outboundLeadingPlusEnabled = outboundLeadingPlusEnabled; + return this; + } + + /** + *

This can be used to configure the outbound authentication if required by the SIP trunk.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage outboundAuthenticationPlan(SipTrunkOutboundAuthenticationPlan outboundAuthenticationPlan) { + this.outboundAuthenticationPlan = Optional.ofNullable(outboundAuthenticationPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "outboundAuthenticationPlan", nulls = Nulls.SKIP) + public _FinalStage outboundAuthenticationPlan( + Optional outboundAuthenticationPlan) { + this.outboundAuthenticationPlan = outboundAuthenticationPlan; + return this; + } + + /** + *

This is the name of the SIP trunk. This is just for your reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the list of SIP trunk's gateways.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllGateways(List gateways) { + this.gateways.addAll(gateways); + return this; + } + + /** + *

This is the list of SIP trunk's gateways.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addGateways(SipTrunkGateway gateways) { + this.gateways.add(gateways); + return this; + } + + @java.lang.Override + @JsonSetter(value = "gateways", nulls = Nulls.SKIP) + public _FinalStage gateways(List gateways) { + this.gateways.clear(); + this.gateways.addAll(gateways); + return this; + } + + /** + *

This can be used to bring your own SIP trunks or to connect to a Carrier.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage provider(String provider) { + this.provider = Optional.ofNullable(provider); + return this; + } + + @java.lang.Override + @JsonSetter(value = "provider", nulls = Nulls.SKIP) + public _FinalStage provider(Optional provider) { + this.provider = provider; + return this; + } + + @java.lang.Override + public ByoSipTrunkCredential build() { + return new ByoSipTrunkCredential( + provider, + id, + orgId, + createdAt, + updatedAt, + gateways, + name, + outboundAuthenticationPlan, + outboundLeadingPlusEnabled, + sbcConfiguration, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/Call.java b/src/main/java/com/vapi/api/types/Call.java new file mode 100644 index 0000000..0da36d8 --- /dev/null +++ b/src/main/java/com/vapi/api/types/Call.java @@ -0,0 +1,1277 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Call.Builder.class) +public final class Call { + private final Optional type; + + private final Optional> costs; + + private final Optional> messages; + + private final Optional phoneCallProvider; + + private final Optional phoneCallTransport; + + private final Optional status; + + private final Optional endedReason; + + private final Optional destination; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional startedAt; + + private final Optional endedAt; + + private final Optional cost; + + private final Optional costBreakdown; + + private final Optional artifactPlan; + + private final Optional analysis; + + private final Optional monitor; + + private final Optional artifact; + + private final Optional phoneCallProviderId; + + private final Optional assistantId; + + private final Optional assistant; + + private final Optional assistantOverrides; + + private final Optional squadId; + + private final Optional squad; + + private final Optional phoneNumberId; + + private final Optional phoneNumber; + + private final Optional customerId; + + private final Optional customer; + + private final Optional name; + + private final Map additionalProperties; + + private Call( + Optional type, + Optional> costs, + Optional> messages, + Optional phoneCallProvider, + Optional phoneCallTransport, + Optional status, + Optional endedReason, + Optional destination, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional startedAt, + Optional endedAt, + Optional cost, + Optional costBreakdown, + Optional artifactPlan, + Optional analysis, + Optional monitor, + Optional artifact, + Optional phoneCallProviderId, + Optional assistantId, + Optional assistant, + Optional assistantOverrides, + Optional squadId, + Optional squad, + Optional phoneNumberId, + Optional phoneNumber, + Optional customerId, + Optional customer, + Optional name, + Map additionalProperties) { + this.type = type; + this.costs = costs; + this.messages = messages; + this.phoneCallProvider = phoneCallProvider; + this.phoneCallTransport = phoneCallTransport; + this.status = status; + this.endedReason = endedReason; + this.destination = destination; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.startedAt = startedAt; + this.endedAt = endedAt; + this.cost = cost; + this.costBreakdown = costBreakdown; + this.artifactPlan = artifactPlan; + this.analysis = analysis; + this.monitor = monitor; + this.artifact = artifact; + this.phoneCallProviderId = phoneCallProviderId; + this.assistantId = assistantId; + this.assistant = assistant; + this.assistantOverrides = assistantOverrides; + this.squadId = squadId; + this.squad = squad; + this.phoneNumberId = phoneNumberId; + this.phoneNumber = phoneNumber; + this.customerId = customerId; + this.customer = customer; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the type of call. + */ + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return These are the costs of individual components of the call in USD. + */ + @JsonProperty("costs") + public Optional> getCosts() { + return costs; + } + + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the provider of the call. + *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ */ + @JsonProperty("phoneCallProvider") + public Optional getPhoneCallProvider() { + return phoneCallProvider; + } + + /** + * @return This is the transport of the phone call. + *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ */ + @JsonProperty("phoneCallTransport") + public Optional getPhoneCallTransport() { + return phoneCallTransport; + } + + /** + * @return This is the status of the call. + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return This is the explanation for how the call ended. + */ + @JsonProperty("endedReason") + public Optional getEndedReason() { + return endedReason; + } + + /** + * @return This is the destination where the call ended up being transferred to. If the call was not transferred, this will be empty. + */ + @JsonProperty("destination") + public Optional getDestination() { + return destination; + } + + /** + * @return This is the unique identifier for the call. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this call belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the call was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the call was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the call was started. + */ + @JsonProperty("startedAt") + public Optional getStartedAt() { + return startedAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the call was ended. + */ + @JsonProperty("endedAt") + public Optional getEndedAt() { + return endedAt; + } + + /** + * @return This is the cost of the call in USD. + */ + @JsonProperty("cost") + public Optional getCost() { + return cost; + } + + /** + * @return This is the cost of the call in USD. + */ + @JsonProperty("costBreakdown") + public Optional getCostBreakdown() { + return costBreakdown; + } + + /** + * @return This is a copy of assistant artifact plan. This isn't actually stored on the call but rather just returned in POST /call/web to enable artifact creation client side. + */ + @JsonProperty("artifactPlan") + public Optional getArtifactPlan() { + return artifactPlan; + } + + /** + * @return This is the analysis of the call. Configure in assistant.analysisPlan. + */ + @JsonProperty("analysis") + public Optional getAnalysis() { + return analysis; + } + + /** + * @return This is to real-time monitor the call. Configure in assistant.monitorPlan. + */ + @JsonProperty("monitor") + public Optional getMonitor() { + return monitor; + } + + /** + * @return These are the artifacts created from the call. Configure in assistant.artifactPlan. + */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return The ID of the call as provided by the phone number service. callSid in Twilio. conversationUuid in Vonage. + *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ */ + @JsonProperty("phoneCallProviderId") + public Optional getPhoneCallProviderId() { + return phoneCallProviderId; + } + + /** + * @return This is the assistant that will be used for the call. To use a transient assistant, use assistant instead. + */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the assistant that will be used for the call. To use an existing assistant, use assistantId instead. + */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return These are the overrides for the assistant or assistantId's settings and template variables. + */ + @JsonProperty("assistantOverrides") + public Optional getAssistantOverrides() { + return assistantOverrides; + } + + /** + * @return This is the squad that will be used for the call. To use a transient squad, use squad instead. + */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is a squad that will be used for the call. To use an existing squad, use squadId instead. + */ + @JsonProperty("squad") + public Optional getSquad() { + return squad; + } + + /** + * @return This is the phone number that will be used for the call. To use a transient number, use phoneNumber instead. + *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ */ + @JsonProperty("phoneNumberId") + public Optional getPhoneNumberId() { + return phoneNumberId; + } + + /** + * @return This is the phone number that will be used for the call. To use an existing number, use phoneNumberId instead. + *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the customer that will be called. To call a transient customer , use customer instead. + *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ */ + @JsonProperty("customerId") + public Optional getCustomerId() { + return customerId; + } + + /** + * @return This is the customer that will be called. To call an existing customer, use customerId instead. + *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the name of the call. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Call && equalTo((Call) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Call other) { + return type.equals(other.type) + && costs.equals(other.costs) + && messages.equals(other.messages) + && phoneCallProvider.equals(other.phoneCallProvider) + && phoneCallTransport.equals(other.phoneCallTransport) + && status.equals(other.status) + && endedReason.equals(other.endedReason) + && destination.equals(other.destination) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && startedAt.equals(other.startedAt) + && endedAt.equals(other.endedAt) + && cost.equals(other.cost) + && costBreakdown.equals(other.costBreakdown) + && artifactPlan.equals(other.artifactPlan) + && analysis.equals(other.analysis) + && monitor.equals(other.monitor) + && artifact.equals(other.artifact) + && phoneCallProviderId.equals(other.phoneCallProviderId) + && assistantId.equals(other.assistantId) + && assistant.equals(other.assistant) + && assistantOverrides.equals(other.assistantOverrides) + && squadId.equals(other.squadId) + && squad.equals(other.squad) + && phoneNumberId.equals(other.phoneNumberId) + && phoneNumber.equals(other.phoneNumber) + && customerId.equals(other.customerId) + && customer.equals(other.customer) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.costs, + this.messages, + this.phoneCallProvider, + this.phoneCallTransport, + this.status, + this.endedReason, + this.destination, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.startedAt, + this.endedAt, + this.cost, + this.costBreakdown, + this.artifactPlan, + this.analysis, + this.monitor, + this.artifact, + this.phoneCallProviderId, + this.assistantId, + this.assistant, + this.assistantOverrides, + this.squadId, + this.squad, + this.phoneNumberId, + this.phoneNumber, + this.customerId, + this.customer, + this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(Call other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + Call build(); + + _FinalStage type(Optional type); + + _FinalStage type(CallType type); + + _FinalStage costs(Optional> costs); + + _FinalStage costs(List costs); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage phoneCallProvider(Optional phoneCallProvider); + + _FinalStage phoneCallProvider(CallPhoneCallProvider phoneCallProvider); + + _FinalStage phoneCallTransport(Optional phoneCallTransport); + + _FinalStage phoneCallTransport(CallPhoneCallTransport phoneCallTransport); + + _FinalStage status(Optional status); + + _FinalStage status(CallStatus status); + + _FinalStage endedReason(Optional endedReason); + + _FinalStage endedReason(CallEndedReason endedReason); + + _FinalStage destination(Optional destination); + + _FinalStage destination(CallDestination destination); + + _FinalStage startedAt(Optional startedAt); + + _FinalStage startedAt(OffsetDateTime startedAt); + + _FinalStage endedAt(Optional endedAt); + + _FinalStage endedAt(OffsetDateTime endedAt); + + _FinalStage cost(Optional cost); + + _FinalStage cost(Double cost); + + _FinalStage costBreakdown(Optional costBreakdown); + + _FinalStage costBreakdown(CostBreakdown costBreakdown); + + _FinalStage artifactPlan(Optional artifactPlan); + + _FinalStage artifactPlan(ArtifactPlan artifactPlan); + + _FinalStage analysis(Optional analysis); + + _FinalStage analysis(Analysis analysis); + + _FinalStage monitor(Optional monitor); + + _FinalStage monitor(Monitor monitor); + + _FinalStage artifact(Optional artifact); + + _FinalStage artifact(Artifact artifact); + + _FinalStage phoneCallProviderId(Optional phoneCallProviderId); + + _FinalStage phoneCallProviderId(String phoneCallProviderId); + + _FinalStage assistantId(Optional assistantId); + + _FinalStage assistantId(String assistantId); + + _FinalStage assistant(Optional assistant); + + _FinalStage assistant(CreateAssistantDto assistant); + + _FinalStage assistantOverrides(Optional assistantOverrides); + + _FinalStage assistantOverrides(AssistantOverrides assistantOverrides); + + _FinalStage squadId(Optional squadId); + + _FinalStage squadId(String squadId); + + _FinalStage squad(Optional squad); + + _FinalStage squad(CreateSquadDto squad); + + _FinalStage phoneNumberId(Optional phoneNumberId); + + _FinalStage phoneNumberId(String phoneNumberId); + + _FinalStage phoneNumber(Optional phoneNumber); + + _FinalStage phoneNumber(ImportTwilioPhoneNumberDto phoneNumber); + + _FinalStage customerId(Optional customerId); + + _FinalStage customerId(String customerId); + + _FinalStage customer(Optional customer); + + _FinalStage customer(CreateCustomerDto customer); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional name = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional customerId = Optional.empty(); + + private Optional phoneNumber = Optional.empty(); + + private Optional phoneNumberId = Optional.empty(); + + private Optional squad = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional assistantOverrides = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional phoneCallProviderId = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional monitor = Optional.empty(); + + private Optional analysis = Optional.empty(); + + private Optional artifactPlan = Optional.empty(); + + private Optional costBreakdown = Optional.empty(); + + private Optional cost = Optional.empty(); + + private Optional endedAt = Optional.empty(); + + private Optional startedAt = Optional.empty(); + + private Optional destination = Optional.empty(); + + private Optional endedReason = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional phoneCallTransport = Optional.empty(); + + private Optional phoneCallProvider = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional> costs = Optional.empty(); + + private Optional type = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Call other) { + type(other.getType()); + costs(other.getCosts()); + messages(other.getMessages()); + phoneCallProvider(other.getPhoneCallProvider()); + phoneCallTransport(other.getPhoneCallTransport()); + status(other.getStatus()); + endedReason(other.getEndedReason()); + destination(other.getDestination()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + startedAt(other.getStartedAt()); + endedAt(other.getEndedAt()); + cost(other.getCost()); + costBreakdown(other.getCostBreakdown()); + artifactPlan(other.getArtifactPlan()); + analysis(other.getAnalysis()); + monitor(other.getMonitor()); + artifact(other.getArtifact()); + phoneCallProviderId(other.getPhoneCallProviderId()); + assistantId(other.getAssistantId()); + assistant(other.getAssistant()); + assistantOverrides(other.getAssistantOverrides()); + squadId(other.getSquadId()); + squad(other.getSquad()); + phoneNumberId(other.getPhoneNumberId()); + phoneNumber(other.getPhoneNumber()); + customerId(other.getCustomerId()); + customer(other.getCustomer()); + name(other.getName()); + return this; + } + + /** + *

This is the unique identifier for the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this call belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the call was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the call was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the name of the call. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the customer that will be called. To call an existing customer, use customerId instead.

+ *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @java.lang.Override + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public _FinalStage customer(Optional customer) { + this.customer = customer; + return this; + } + + /** + *

This is the customer that will be called. To call a transient customer , use customer instead.

+ *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerId(String customerId) { + this.customerId = Optional.ofNullable(customerId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "customerId", nulls = Nulls.SKIP) + public _FinalStage customerId(Optional customerId) { + this.customerId = customerId; + return this; + } + + /** + *

This is the phone number that will be used for the call. To use an existing number, use phoneNumberId instead.

+ *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneNumber(ImportTwilioPhoneNumberDto phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public _FinalStage phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + *

This is the phone number that will be used for the call. To use a transient number, use phoneNumber instead.

+ *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneNumberId(String phoneNumberId) { + this.phoneNumberId = Optional.ofNullable(phoneNumberId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phoneNumberId", nulls = Nulls.SKIP) + public _FinalStage phoneNumberId(Optional phoneNumberId) { + this.phoneNumberId = phoneNumberId; + return this; + } + + /** + *

This is a squad that will be used for the call. To use an existing squad, use squadId instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage squad(CreateSquadDto squad) { + this.squad = Optional.ofNullable(squad); + return this; + } + + @java.lang.Override + @JsonSetter(value = "squad", nulls = Nulls.SKIP) + public _FinalStage squad(Optional squad) { + this.squad = squad; + return this; + } + + /** + *

This is the squad that will be used for the call. To use a transient squad, use squad instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public _FinalStage squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + /** + *

These are the overrides for the assistant or assistantId's settings and template variables.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistantOverrides(AssistantOverrides assistantOverrides) { + this.assistantOverrides = Optional.ofNullable(assistantOverrides); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistantOverrides", nulls = Nulls.SKIP) + public _FinalStage assistantOverrides(Optional assistantOverrides) { + this.assistantOverrides = assistantOverrides; + return this; + } + + /** + *

This is the assistant that will be used for the call. To use an existing assistant, use assistantId instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public _FinalStage assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + /** + *

This is the assistant that will be used for the call. To use a transient assistant, use assistant instead.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public _FinalStage assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + /** + *

The ID of the call as provided by the phone number service. callSid in Twilio. conversationUuid in Vonage.

+ *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneCallProviderId(String phoneCallProviderId) { + this.phoneCallProviderId = Optional.ofNullable(phoneCallProviderId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phoneCallProviderId", nulls = Nulls.SKIP) + public _FinalStage phoneCallProviderId(Optional phoneCallProviderId) { + this.phoneCallProviderId = phoneCallProviderId; + return this; + } + + /** + *

These are the artifacts created from the call. Configure in assistant.artifactPlan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @java.lang.Override + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public _FinalStage artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + /** + *

This is to real-time monitor the call. Configure in assistant.monitorPlan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage monitor(Monitor monitor) { + this.monitor = Optional.ofNullable(monitor); + return this; + } + + @java.lang.Override + @JsonSetter(value = "monitor", nulls = Nulls.SKIP) + public _FinalStage monitor(Optional monitor) { + this.monitor = monitor; + return this; + } + + /** + *

This is the analysis of the call. Configure in assistant.analysisPlan.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage analysis(Analysis analysis) { + this.analysis = Optional.ofNullable(analysis); + return this; + } + + @java.lang.Override + @JsonSetter(value = "analysis", nulls = Nulls.SKIP) + public _FinalStage analysis(Optional analysis) { + this.analysis = analysis; + return this; + } + + /** + *

This is a copy of assistant artifact plan. This isn't actually stored on the call but rather just returned in POST /call/web to enable artifact creation client side.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage artifactPlan(ArtifactPlan artifactPlan) { + this.artifactPlan = Optional.ofNullable(artifactPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "artifactPlan", nulls = Nulls.SKIP) + public _FinalStage artifactPlan(Optional artifactPlan) { + this.artifactPlan = artifactPlan; + return this; + } + + /** + *

This is the cost of the call in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costBreakdown(CostBreakdown costBreakdown) { + this.costBreakdown = Optional.ofNullable(costBreakdown); + return this; + } + + @java.lang.Override + @JsonSetter(value = "costBreakdown", nulls = Nulls.SKIP) + public _FinalStage costBreakdown(Optional costBreakdown) { + this.costBreakdown = costBreakdown; + return this; + } + + /** + *

This is the cost of the call in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cost(Double cost) { + this.cost = Optional.ofNullable(cost); + return this; + } + + @java.lang.Override + @JsonSetter(value = "cost", nulls = Nulls.SKIP) + public _FinalStage cost(Optional cost) { + this.cost = cost; + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the call was ended.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endedAt(OffsetDateTime endedAt) { + this.endedAt = Optional.ofNullable(endedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "endedAt", nulls = Nulls.SKIP) + public _FinalStage endedAt(Optional endedAt) { + this.endedAt = endedAt; + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the call was started.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startedAt(OffsetDateTime startedAt) { + this.startedAt = Optional.ofNullable(startedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "startedAt", nulls = Nulls.SKIP) + public _FinalStage startedAt(Optional startedAt) { + this.startedAt = startedAt; + return this; + } + + /** + *

This is the destination where the call ended up being transferred to. If the call was not transferred, this will be empty.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destination(CallDestination destination) { + this.destination = Optional.ofNullable(destination); + return this; + } + + @java.lang.Override + @JsonSetter(value = "destination", nulls = Nulls.SKIP) + public _FinalStage destination(Optional destination) { + this.destination = destination; + return this; + } + + /** + *

This is the explanation for how the call ended.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endedReason(CallEndedReason endedReason) { + this.endedReason = Optional.ofNullable(endedReason); + return this; + } + + @java.lang.Override + @JsonSetter(value = "endedReason", nulls = Nulls.SKIP) + public _FinalStage endedReason(Optional endedReason) { + this.endedReason = endedReason; + return this; + } + + /** + *

This is the status of the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage status(CallStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + /** + *

This is the transport of the phone call.

+ *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneCallTransport(CallPhoneCallTransport phoneCallTransport) { + this.phoneCallTransport = Optional.ofNullable(phoneCallTransport); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phoneCallTransport", nulls = Nulls.SKIP) + public _FinalStage phoneCallTransport(Optional phoneCallTransport) { + this.phoneCallTransport = phoneCallTransport; + return this; + } + + /** + *

This is the provider of the call.

+ *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneCallProvider(CallPhoneCallProvider phoneCallProvider) { + this.phoneCallProvider = Optional.ofNullable(phoneCallProvider); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phoneCallProvider", nulls = Nulls.SKIP) + public _FinalStage phoneCallProvider(Optional phoneCallProvider) { + this.phoneCallProvider = phoneCallProvider; + return this; + } + + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + /** + *

These are the costs of individual components of the call in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costs(List costs) { + this.costs = Optional.ofNullable(costs); + return this; + } + + @java.lang.Override + @JsonSetter(value = "costs", nulls = Nulls.SKIP) + public _FinalStage costs(Optional> costs) { + this.costs = costs; + return this; + } + + /** + *

This is the type of call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage type(CallType type) { + this.type = Optional.ofNullable(type); + return this; + } + + @java.lang.Override + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public _FinalStage type(Optional type) { + this.type = type; + return this; + } + + @java.lang.Override + public Call build() { + return new Call( + type, + costs, + messages, + phoneCallProvider, + phoneCallTransport, + status, + endedReason, + destination, + id, + orgId, + createdAt, + updatedAt, + startedAt, + endedAt, + cost, + costBreakdown, + artifactPlan, + analysis, + monitor, + artifact, + phoneCallProviderId, + assistantId, + assistant, + assistantOverrides, + squadId, + squad, + phoneNumberId, + phoneNumber, + customerId, + customer, + name, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CallCostsItem.java b/src/main/java/com/vapi/api/types/CallCostsItem.java new file mode 100644 index 0000000..31b3906 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CallCostsItem.java @@ -0,0 +1,427 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CallCostsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CallCostsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CallCostsItem transport(TransportCost value) { + return new CallCostsItem(new TransportValue(value)); + } + + public static CallCostsItem transcriber(TranscriberCost value) { + return new CallCostsItem(new TranscriberValue(value)); + } + + public static CallCostsItem model(ModelCost value) { + return new CallCostsItem(new ModelValue(value)); + } + + public static CallCostsItem voice(VoiceCost value) { + return new CallCostsItem(new VoiceValue(value)); + } + + public static CallCostsItem vapi(VapiCost value) { + return new CallCostsItem(new VapiValue(value)); + } + + public static CallCostsItem analysis(AnalysisCost value) { + return new CallCostsItem(new AnalysisValue(value)); + } + + public boolean isTransport() { + return value instanceof TransportValue; + } + + public boolean isTranscriber() { + return value instanceof TranscriberValue; + } + + public boolean isModel() { + return value instanceof ModelValue; + } + + public boolean isVoice() { + return value instanceof VoiceValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean isAnalysis() { + return value instanceof AnalysisValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getTransport() { + if (isTransport()) { + return Optional.of(((TransportValue) value).value); + } + return Optional.empty(); + } + + public Optional getTranscriber() { + if (isTranscriber()) { + return Optional.of(((TranscriberValue) value).value); + } + return Optional.empty(); + } + + public Optional getModel() { + if (isModel()) { + return Optional.of(((ModelValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoice() { + if (isVoice()) { + return Optional.of(((VoiceValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional getAnalysis() { + if (isAnalysis()) { + return Optional.of(((AnalysisValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitTransport(TransportCost transport); + + T visitTranscriber(TranscriberCost transcriber); + + T visitModel(ModelCost model); + + T visitVoice(VoiceCost voice); + + T visitVapi(VapiCost vapi); + + T visitAnalysis(AnalysisCost analysis); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(TransportValue.class), + @JsonSubTypes.Type(TranscriberValue.class), + @JsonSubTypes.Type(ModelValue.class), + @JsonSubTypes.Type(VoiceValue.class), + @JsonSubTypes.Type(VapiValue.class), + @JsonSubTypes.Type(AnalysisValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("transport") + private static final class TransportValue implements Value { + @JsonUnwrapped + private TransportCost value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransportValue() {} + + private TransportValue(TransportCost value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransport(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransportValue && equalTo((TransportValue) other); + } + + private boolean equalTo(TransportValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CallCostsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transcriber") + private static final class TranscriberValue implements Value { + @JsonUnwrapped + private TranscriberCost value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TranscriberValue() {} + + private TranscriberValue(TranscriberCost value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTranscriber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TranscriberValue && equalTo((TranscriberValue) other); + } + + private boolean equalTo(TranscriberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CallCostsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("model") + private static final class ModelValue implements Value { + @JsonUnwrapped + private ModelCost value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ModelValue() {} + + private ModelValue(ModelCost value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitModel(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ModelValue && equalTo((ModelValue) other); + } + + private boolean equalTo(ModelValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CallCostsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voice") + private static final class VoiceValue implements Value { + @JsonUnwrapped + private VoiceCost value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoiceValue() {} + + private VoiceValue(VoiceCost value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoice(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoiceValue && equalTo((VoiceValue) other); + } + + private boolean equalTo(VoiceValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CallCostsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private VapiCost value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(VapiCost value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CallCostsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("analysis") + private static final class AnalysisValue implements Value { + @JsonUnwrapped + private AnalysisCost value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AnalysisValue() {} + + private AnalysisValue(AnalysisCost value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAnalysis(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnalysisValue && equalTo((AnalysisValue) other); + } + + private boolean equalTo(AnalysisValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CallCostsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CallCostsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CallDestination.java b/src/main/java/com/vapi/api/types/CallDestination.java new file mode 100644 index 0000000..6415625 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CallDestination.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CallDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CallDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CallDestination number(TransferDestinationNumber value) { + return new CallDestination(new NumberValue(value)); + } + + public static CallDestination sip(TransferDestinationSip value) { + return new CallDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CallDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CallDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CallDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CallEndedReason.java b/src/main/java/com/vapi/api/types/CallEndedReason.java new file mode 100644 index 0000000..04895d9 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CallEndedReason.java @@ -0,0 +1,376 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CallEndedReason { + ASSISTANT_ERROR("assistant-error"), + + ASSISTANT_NOT_FOUND("assistant-not-found"), + + DB_ERROR("db-error"), + + NO_SERVER_AVAILABLE("no-server-available"), + + LICENSE_CHECK_FAILED("license-check-failed"), + + PIPELINE_ERROR_OPENAI_LLM_FAILED("pipeline-error-openai-llm-failed"), + + PIPELINE_ERROR_AZURE_OPENAI_LLM_FAILED("pipeline-error-azure-openai-llm-failed"), + + PIPELINE_ERROR_GROQ_LLM_FAILED("pipeline-error-groq-llm-failed"), + + PIPELINE_ERROR_ANTHROPIC_LLM_FAILED("pipeline-error-anthropic-llm-failed"), + + PIPELINE_ERROR_VAPI_LLM_FAILED("pipeline-error-vapi-llm-failed"), + + PIPELINE_ERROR_VAPI_400_BAD_REQUEST_VALIDATION_FAILED("pipeline-error-vapi-400-bad-request-validation-failed"), + + PIPELINE_ERROR_VAPI_401_UNAUTHORIZED("pipeline-error-vapi-401-unauthorized"), + + PIPELINE_ERROR_VAPI_403_MODEL_ACCESS_DENIED("pipeline-error-vapi-403-model-access-denied"), + + PIPELINE_ERROR_VAPI_429_EXCEEDED_QUOTA("pipeline-error-vapi-429-exceeded-quota"), + + PIPELINE_ERROR_VAPI_500_SERVER_ERROR("pipeline-error-vapi-500-server-error"), + + PIPELINE_ERROR_OPENAI_VOICE_FAILED("pipeline-error-openai-voice-failed"), + + PIPELINE_ERROR_CARTESIA_VOICE_FAILED("pipeline-error-cartesia-voice-failed"), + + PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED("pipeline-error-deepgram-transcriber-failed"), + + PIPELINE_ERROR_DEEPGRAM_VOICE_FAILED("pipeline-error-deepgram-voice-failed"), + + PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED("pipeline-error-gladia-transcriber-failed"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_FAILED("pipeline-error-eleven-labs-voice-failed"), + + PIPELINE_ERROR_PLAYHT_VOICE_FAILED("pipeline-error-playht-voice-failed"), + + PIPELINE_ERROR_LMNT_VOICE_FAILED("pipeline-error-lmnt-voice-failed"), + + PIPELINE_ERROR_AZURE_VOICE_FAILED("pipeline-error-azure-voice-failed"), + + PIPELINE_ERROR_RIME_AI_VOICE_FAILED("pipeline-error-rime-ai-voice-failed"), + + PIPELINE_ERROR_NEETS_VOICE_FAILED("pipeline-error-neets-voice-failed"), + + PIPELINE_NO_AVAILABLE_MODEL("pipeline-no-available-model"), + + WORKER_SHUTDOWN("worker-shutdown"), + + UNKNOWN_ERROR("unknown-error"), + + VONAGE_DISCONNECTED("vonage-disconnected"), + + VONAGE_FAILED_TO_CONNECT_CALL("vonage-failed-to-connect-call"), + + PHONE_CALL_PROVIDER_BYPASS_ENABLED_BUT_NO_CALL_RECEIVED("phone-call-provider-bypass-enabled-but-no-call-received"), + + VAPIFAULT_PHONE_CALL_WORKER_SETUP_SOCKET_ERROR("vapifault-phone-call-worker-setup-socket-error"), + + VAPIFAULT_PHONE_CALL_WORKER_WORKER_SETUP_SOCKET_TIMEOUT("vapifault-phone-call-worker-worker-setup-socket-timeout"), + + VAPIFAULT_PHONE_CALL_WORKER_COULD_NOT_FIND_CALL("vapifault-phone-call-worker-could-not-find-call"), + + VAPIFAULT_TRANSPORT_NEVER_CONNECTED("vapifault-transport-never-connected"), + + VAPIFAULT_WEB_CALL_WORKER_SETUP_FAILED("vapifault-web-call-worker-setup-failed"), + + VAPIFAULT_TRANSPORT_CONNECTED_BUT_CALL_NOT_ACTIVE("vapifault-transport-connected-but-call-not-active"), + + ASSISTANT_NOT_INVALID("assistant-not-invalid"), + + ASSISTANT_NOT_PROVIDED("assistant-not-provided"), + + CALL_START_ERROR_NEITHER_ASSISTANT_NOR_SERVER_SET("call-start-error-neither-assistant-nor-server-set"), + + ASSISTANT_REQUEST_FAILED("assistant-request-failed"), + + ASSISTANT_REQUEST_RETURNED_ERROR("assistant-request-returned-error"), + + ASSISTANT_REQUEST_RETURNED_UNSPEAKABLE_ERROR("assistant-request-returned-unspeakable-error"), + + ASSISTANT_REQUEST_RETURNED_INVALID_ASSISTANT("assistant-request-returned-invalid-assistant"), + + ASSISTANT_REQUEST_RETURNED_NO_ASSISTANT("assistant-request-returned-no-assistant"), + + ASSISTANT_REQUEST_RETURNED_FORWARDING_PHONE_NUMBER("assistant-request-returned-forwarding-phone-number"), + + ASSISTANT_ENDED_CALL("assistant-ended-call"), + + ASSISTANT_SAID_END_CALL_PHRASE("assistant-said-end-call-phrase"), + + ASSISTANT_FORWARDED_CALL("assistant-forwarded-call"), + + ASSISTANT_JOIN_TIMED_OUT("assistant-join-timed-out"), + + CUSTOMER_BUSY("customer-busy"), + + CUSTOMER_ENDED_CALL("customer-ended-call"), + + CUSTOMER_DID_NOT_ANSWER("customer-did-not-answer"), + + CUSTOMER_DID_NOT_GIVE_MICROPHONE_PERMISSION("customer-did-not-give-microphone-permission"), + + ASSISTANT_SAID_MESSAGE_WITH_END_CALL_ENABLED("assistant-said-message-with-end-call-enabled"), + + EXCEEDED_MAX_DURATION("exceeded-max-duration"), + + MANUALLY_CANCELED("manually-canceled"), + + PHONE_CALL_PROVIDER_CLOSED_WEBSOCKET("phone-call-provider-closed-websocket"), + + PIPELINE_ERROR_OPENAI_400_BAD_REQUEST_VALIDATION_FAILED("pipeline-error-openai-400-bad-request-validation-failed"), + + PIPELINE_ERROR_OPENAI_401_UNAUTHORIZED("pipeline-error-openai-401-unauthorized"), + + PIPELINE_ERROR_OPENAI_403_MODEL_ACCESS_DENIED("pipeline-error-openai-403-model-access-denied"), + + PIPELINE_ERROR_OPENAI_429_EXCEEDED_QUOTA("pipeline-error-openai-429-exceeded-quota"), + + PIPELINE_ERROR_OPENAI_500_SERVER_ERROR("pipeline-error-openai-500-server-error"), + + PIPELINE_ERROR_AZURE_OPENAI_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-azure-openai-400-bad-request-validation-failed"), + + PIPELINE_ERROR_AZURE_OPENAI_401_UNAUTHORIZED("pipeline-error-azure-openai-401-unauthorized"), + + PIPELINE_ERROR_AZURE_OPENAI_403_MODEL_ACCESS_DENIED("pipeline-error-azure-openai-403-model-access-denied"), + + PIPELINE_ERROR_AZURE_OPENAI_429_EXCEEDED_QUOTA("pipeline-error-azure-openai-429-exceeded-quota"), + + PIPELINE_ERROR_AZURE_OPENAI_500_SERVER_ERROR("pipeline-error-azure-openai-500-server-error"), + + PIPELINE_ERROR_GROQ_400_BAD_REQUEST_VALIDATION_FAILED("pipeline-error-groq-400-bad-request-validation-failed"), + + PIPELINE_ERROR_GROQ_401_UNAUTHORIZED("pipeline-error-groq-401-unauthorized"), + + PIPELINE_ERROR_GROQ_403_MODEL_ACCESS_DENIED("pipeline-error-groq-403-model-access-denied"), + + PIPELINE_ERROR_GROQ_429_EXCEEDED_QUOTA("pipeline-error-groq-429-exceeded-quota"), + + PIPELINE_ERROR_GROQ_500_SERVER_ERROR("pipeline-error-groq-500-server-error"), + + PIPELINE_ERROR_ANTHROPIC_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-anthropic-400-bad-request-validation-failed"), + + PIPELINE_ERROR_ANTHROPIC_401_UNAUTHORIZED("pipeline-error-anthropic-401-unauthorized"), + + PIPELINE_ERROR_ANTHROPIC_403_MODEL_ACCESS_DENIED("pipeline-error-anthropic-403-model-access-denied"), + + PIPELINE_ERROR_ANTHROPIC_429_EXCEEDED_QUOTA("pipeline-error-anthropic-429-exceeded-quota"), + + PIPELINE_ERROR_ANTHROPIC_500_SERVER_ERROR("pipeline-error-anthropic-500-server-error"), + + PIPELINE_ERROR_TOGETHER_AI_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-together-ai-400-bad-request-validation-failed"), + + PIPELINE_ERROR_TOGETHER_AI_401_UNAUTHORIZED("pipeline-error-together-ai-401-unauthorized"), + + PIPELINE_ERROR_TOGETHER_AI_403_MODEL_ACCESS_DENIED("pipeline-error-together-ai-403-model-access-denied"), + + PIPELINE_ERROR_TOGETHER_AI_429_EXCEEDED_QUOTA("pipeline-error-together-ai-429-exceeded-quota"), + + PIPELINE_ERROR_TOGETHER_AI_500_SERVER_ERROR("pipeline-error-together-ai-500-server-error"), + + PIPELINE_ERROR_TOGETHER_AI_LLM_FAILED("pipeline-error-together-ai-llm-failed"), + + PIPELINE_ERROR_ANYSCALE_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-anyscale-400-bad-request-validation-failed"), + + PIPELINE_ERROR_ANYSCALE_401_UNAUTHORIZED("pipeline-error-anyscale-401-unauthorized"), + + PIPELINE_ERROR_ANYSCALE_403_MODEL_ACCESS_DENIED("pipeline-error-anyscale-403-model-access-denied"), + + PIPELINE_ERROR_ANYSCALE_429_EXCEEDED_QUOTA("pipeline-error-anyscale-429-exceeded-quota"), + + PIPELINE_ERROR_ANYSCALE_500_SERVER_ERROR("pipeline-error-anyscale-500-server-error"), + + PIPELINE_ERROR_ANYSCALE_LLM_FAILED("pipeline-error-anyscale-llm-failed"), + + PIPELINE_ERROR_OPENROUTER_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-openrouter-400-bad-request-validation-failed"), + + PIPELINE_ERROR_OPENROUTER_401_UNAUTHORIZED("pipeline-error-openrouter-401-unauthorized"), + + PIPELINE_ERROR_OPENROUTER_403_MODEL_ACCESS_DENIED("pipeline-error-openrouter-403-model-access-denied"), + + PIPELINE_ERROR_OPENROUTER_429_EXCEEDED_QUOTA("pipeline-error-openrouter-429-exceeded-quota"), + + PIPELINE_ERROR_OPENROUTER_500_SERVER_ERROR("pipeline-error-openrouter-500-server-error"), + + PIPELINE_ERROR_OPENROUTER_LLM_FAILED("pipeline-error-openrouter-llm-failed"), + + PIPELINE_ERROR_PERPLEXITY_AI_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-perplexity-ai-400-bad-request-validation-failed"), + + PIPELINE_ERROR_PERPLEXITY_AI_401_UNAUTHORIZED("pipeline-error-perplexity-ai-401-unauthorized"), + + PIPELINE_ERROR_PERPLEXITY_AI_403_MODEL_ACCESS_DENIED("pipeline-error-perplexity-ai-403-model-access-denied"), + + PIPELINE_ERROR_PERPLEXITY_AI_429_EXCEEDED_QUOTA("pipeline-error-perplexity-ai-429-exceeded-quota"), + + PIPELINE_ERROR_PERPLEXITY_AI_500_SERVER_ERROR("pipeline-error-perplexity-ai-500-server-error"), + + PIPELINE_ERROR_PERPLEXITY_AI_LLM_FAILED("pipeline-error-perplexity-ai-llm-failed"), + + PIPELINE_ERROR_DEEPINFRA_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-deepinfra-400-bad-request-validation-failed"), + + PIPELINE_ERROR_DEEPINFRA_401_UNAUTHORIZED("pipeline-error-deepinfra-401-unauthorized"), + + PIPELINE_ERROR_DEEPINFRA_403_MODEL_ACCESS_DENIED("pipeline-error-deepinfra-403-model-access-denied"), + + PIPELINE_ERROR_DEEPINFRA_429_EXCEEDED_QUOTA("pipeline-error-deepinfra-429-exceeded-quota"), + + PIPELINE_ERROR_DEEPINFRA_500_SERVER_ERROR("pipeline-error-deepinfra-500-server-error"), + + PIPELINE_ERROR_DEEPINFRA_LLM_FAILED("pipeline-error-deepinfra-llm-failed"), + + PIPELINE_ERROR_RUNPOD_400_BAD_REQUEST_VALIDATION_FAILED("pipeline-error-runpod-400-bad-request-validation-failed"), + + PIPELINE_ERROR_RUNPOD_401_UNAUTHORIZED("pipeline-error-runpod-401-unauthorized"), + + PIPELINE_ERROR_RUNPOD_403_MODEL_ACCESS_DENIED("pipeline-error-runpod-403-model-access-denied"), + + PIPELINE_ERROR_RUNPOD_429_EXCEEDED_QUOTA("pipeline-error-runpod-429-exceeded-quota"), + + PIPELINE_ERROR_RUNPOD_500_SERVER_ERROR("pipeline-error-runpod-500-server-error"), + + PIPELINE_ERROR_RUNPOD_LLM_FAILED("pipeline-error-runpod-llm-failed"), + + PIPELINE_ERROR_CUSTOM_LLM_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-custom-llm-400-bad-request-validation-failed"), + + PIPELINE_ERROR_CUSTOM_LLM_401_UNAUTHORIZED("pipeline-error-custom-llm-401-unauthorized"), + + PIPELINE_ERROR_CUSTOM_LLM_403_MODEL_ACCESS_DENIED("pipeline-error-custom-llm-403-model-access-denied"), + + PIPELINE_ERROR_CUSTOM_LLM_429_EXCEEDED_QUOTA("pipeline-error-custom-llm-429-exceeded-quota"), + + PIPELINE_ERROR_CUSTOM_LLM_500_SERVER_ERROR("pipeline-error-custom-llm-500-server-error"), + + PIPELINE_ERROR_CUSTOM_LLM_LLM_FAILED("pipeline-error-custom-llm-llm-failed"), + + PIPELINE_ERROR_CARTESIA_SOCKET_HANG_UP("pipeline-error-cartesia-socket-hang-up"), + + PIPELINE_ERROR_CARTESIA_REQUESTED_PAYMENT("pipeline-error-cartesia-requested-payment"), + + PIPELINE_ERROR_CARTESIA_500_SERVER_ERROR("pipeline-error-cartesia-500-server-error"), + + PIPELINE_ERROR_CARTESIA_503_SERVER_ERROR("pipeline-error-cartesia-503-server-error"), + + PIPELINE_ERROR_CARTESIA_522_SERVER_ERROR("pipeline-error-cartesia-522-server-error"), + + PIPELINE_ERROR_CUSTOM_VOICE_FAILED("pipeline-error-custom-voice-failed"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_FOUND("pipeline-error-eleven-labs-voice-not-found"), + + PIPELINE_ERROR_ELEVEN_LABS_QUOTA_EXCEEDED("pipeline-error-eleven-labs-quota-exceeded"), + + PIPELINE_ERROR_ELEVEN_LABS_UNAUTHORIZED_ACCESS("pipeline-error-eleven-labs-unauthorized-access"), + + PIPELINE_ERROR_ELEVEN_LABS_UNAUTHORIZED_TO_ACCESS_MODEL("pipeline-error-eleven-labs-unauthorized-to-access-model"), + + PIPELINE_ERROR_ELEVEN_LABS_PROFESSIONAL_VOICES_ONLY_FOR_CREATOR_PLUS( + "pipeline-error-eleven-labs-professional-voices-only-for-creator-plus"), + + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_FREE_PLAN_AND_REQUESTED_UPGRADE( + "pipeline-error-eleven-labs-blocked-free-plan-and-requested-upgrade"), + + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_CONCURRENT_REQUESTS_AND_REQUESTED_UPGRADE( + "pipeline-error-eleven-labs-blocked-concurrent-requests-and-requested-upgrade"), + + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_USING_INSTANT_VOICE_CLONE_AND_REQUESTED_UPGRADE( + "pipeline-error-eleven-labs-blocked-using-instant-voice-clone-and-requested-upgrade"), + + PIPELINE_ERROR_ELEVEN_LABS_SYSTEM_BUSY_AND_REQUESTED_UPGRADE( + "pipeline-error-eleven-labs-system-busy-and-requested-upgrade"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_FINE_TUNED("pipeline-error-eleven-labs-voice-not-fine-tuned"), + + PIPELINE_ERROR_ELEVEN_LABS_INVALID_API_KEY("pipeline-error-eleven-labs-invalid-api-key"), + + PIPELINE_ERROR_ELEVEN_LABS_INVALID_VOICE_SAMPLES("pipeline-error-eleven-labs-invalid-voice-samples"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_DISABLED_BY_OWNER("pipeline-error-eleven-labs-voice-disabled-by-owner"), + + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_ACCOUNT_IN_PROBATION("pipeline-error-eleven-labs-blocked-account-in-probation"), + + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_CONTENT_AGAINST_THEIR_POLICY( + "pipeline-error-eleven-labs-blocked-content-against-their-policy"), + + PIPELINE_ERROR_ELEVEN_LABS_MISSING_SAMPLES_FOR_VOICE_CLONE( + "pipeline-error-eleven-labs-missing-samples-for-voice-clone"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_FINE_TUNED_AND_CANNOT_BE_USED( + "pipeline-error-eleven-labs-voice-not-fine-tuned-and-cannot-be-used"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_ALLOWED_FOR_FREE_USERS( + "pipeline-error-eleven-labs-voice-not-allowed-for-free-users"), + + PIPELINE_ERROR_ELEVEN_LABS_500_SERVER_ERROR("pipeline-error-eleven-labs-500-server-error"), + + PIPELINE_ERROR_ELEVEN_LABS_MAX_CHARACTER_LIMIT_EXCEEDED("pipeline-error-eleven-labs-max-character-limit-exceeded"), + + PIPELINE_ERROR_PLAYHT_REQUEST_TIMED_OUT("pipeline-error-playht-request-timed-out"), + + PIPELINE_ERROR_PLAYHT_INVALID_VOICE("pipeline-error-playht-invalid-voice"), + + PIPELINE_ERROR_PLAYHT_UNEXPECTED_ERROR("pipeline-error-playht-unexpected-error"), + + PIPELINE_ERROR_PLAYHT_OUT_OF_CREDITS("pipeline-error-playht-out-of-credits"), + + PIPELINE_ERROR_PLAYHT_VOICE_MUST_BE_A_VALID_VOICE_MANIFEST_URI( + "pipeline-error-playht-voice-must-be-a-valid-voice-manifest-uri"), + + PIPELINE_ERROR_PLAYHT_401_UNAUTHORIZED("pipeline-error-playht-401-unauthorized"), + + PIPELINE_ERROR_PLAYHT_403_FORBIDDEN_OUT_OF_CHARACTERS("pipeline-error-playht-403-forbidden-out-of-characters"), + + PIPELINE_ERROR_PLAYHT_403_FORBIDDEN_API_ACCESS_NOT_AVAILABLE( + "pipeline-error-playht-403-forbidden-api-access-not-available"), + + PIPELINE_ERROR_PLAYHT_429_EXCEEDED_QUOTA("pipeline-error-playht-429-exceeded-quota"), + + PIPELINE_ERROR_PLAYHT_502_GATEWAY_ERROR("pipeline-error-playht-502-gateway-error"), + + PIPELINE_ERROR_PLAYHT_504_GATEWAY_ERROR("pipeline-error-playht-504-gateway-error"), + + PIPELINE_ERROR_DEEPGRAM_403_MODEL_ACCESS_DENIED("pipeline-error-deepgram-403-model-access-denied"), + + PIPELINE_ERROR_DEEPGRAM_404_NOT_FOUND("pipeline-error-deepgram-404-not-found"), + + PIPELINE_ERROR_DEEPGRAM_400_NO_SUCH_MODEL_LANGUAGE_TIER_COMBINATION( + "pipeline-error-deepgram-400-no-such-model-language-tier-combination"), + + PIPELINE_ERROR_DEEPGRAM_500_RETURNING_INVALID_JSON("pipeline-error-deepgram-500-returning-invalid-json"), + + SIP_GATEWAY_FAILED_TO_CONNECT_CALL("sip-gateway-failed-to-connect-call"), + + SILENCE_TIMED_OUT("silence-timed-out"), + + TWILIO_FAILED_TO_CONNECT_CALL("twilio-failed-to-connect-call"), + + TWILIO_REPORTED_CUSTOMER_MISDIALED("twilio-reported-customer-misdialed"), + + VOICEMAIL("voicemail"), + + VONAGE_REJECTED("vonage-rejected"); + + private final String value; + + CallEndedReason(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CallMessagesItem.java b/src/main/java/com/vapi/api/types/CallMessagesItem.java new file mode 100644 index 0000000..b10a6c8 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CallMessagesItem.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.vapi.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = CallMessagesItem.Deserializer.class) +public final class CallMessagesItem { + private final Object value; + + private final int type; + + private CallMessagesItem(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((UserMessage) this.value); + } else if (this.type == 1) { + return visitor.visit((SystemMessage) this.value); + } else if (this.type == 2) { + return visitor.visit((BotMessage) this.value); + } else if (this.type == 3) { + return visitor.visit((ToolCallMessage) this.value); + } else if (this.type == 4) { + return visitor.visit((ToolCallResultMessage) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CallMessagesItem && equalTo((CallMessagesItem) other); + } + + private boolean equalTo(CallMessagesItem other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static CallMessagesItem of(UserMessage value) { + return new CallMessagesItem(value, 0); + } + + public static CallMessagesItem of(SystemMessage value) { + return new CallMessagesItem(value, 1); + } + + public static CallMessagesItem of(BotMessage value) { + return new CallMessagesItem(value, 2); + } + + public static CallMessagesItem of(ToolCallMessage value) { + return new CallMessagesItem(value, 3); + } + + public static CallMessagesItem of(ToolCallResultMessage value) { + return new CallMessagesItem(value, 4); + } + + public interface Visitor { + T visit(UserMessage value); + + T visit(SystemMessage value); + + T visit(BotMessage value); + + T visit(ToolCallMessage value); + + T visit(ToolCallResultMessage value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(CallMessagesItem.class); + } + + @java.lang.Override + public CallMessagesItem deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, UserMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, SystemMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, BotMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ToolCallMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ToolCallResultMessage.class)); + } catch (IllegalArgumentException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CallPaginatedResponse.java b/src/main/java/com/vapi/api/types/CallPaginatedResponse.java new file mode 100644 index 0000000..5854c7b --- /dev/null +++ b/src/main/java/com/vapi/api/types/CallPaginatedResponse.java @@ -0,0 +1,143 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CallPaginatedResponse.Builder.class) +public final class CallPaginatedResponse { + private final List results; + + private final PaginationMeta metadata; + + private final Map additionalProperties; + + private CallPaginatedResponse( + List results, PaginationMeta metadata, Map additionalProperties) { + this.results = results; + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("results") + public List getResults() { + return results; + } + + @JsonProperty("metadata") + public PaginationMeta getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CallPaginatedResponse && equalTo((CallPaginatedResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CallPaginatedResponse other) { + return results.equals(other.results) && metadata.equals(other.metadata); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.results, this.metadata); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MetadataStage builder() { + return new Builder(); + } + + public interface MetadataStage { + _FinalStage metadata(@NotNull PaginationMeta metadata); + + Builder from(CallPaginatedResponse other); + } + + public interface _FinalStage { + CallPaginatedResponse build(); + + _FinalStage results(List results); + + _FinalStage addResults(Call results); + + _FinalStage addAllResults(List results); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MetadataStage, _FinalStage { + private PaginationMeta metadata; + + private List results = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CallPaginatedResponse other) { + results(other.getResults()); + metadata(other.getMetadata()); + return this; + } + + @java.lang.Override + @JsonSetter("metadata") + public _FinalStage metadata(@NotNull PaginationMeta metadata) { + this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllResults(List results) { + this.results.addAll(results); + return this; + } + + @java.lang.Override + public _FinalStage addResults(Call results) { + this.results.add(results); + return this; + } + + @java.lang.Override + @JsonSetter(value = "results", nulls = Nulls.SKIP) + public _FinalStage results(List results) { + this.results.clear(); + this.results.addAll(results); + return this; + } + + @java.lang.Override + public CallPaginatedResponse build() { + return new CallPaginatedResponse(results, metadata, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CallPhoneCallProvider.java b/src/main/java/com/vapi/api/types/CallPhoneCallProvider.java new file mode 100644 index 0000000..8e78243 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CallPhoneCallProvider.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CallPhoneCallProvider { + TWILIO("twilio"), + + VONAGE("vonage"), + + VAPI("vapi"); + + private final String value; + + CallPhoneCallProvider(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CallPhoneCallTransport.java b/src/main/java/com/vapi/api/types/CallPhoneCallTransport.java new file mode 100644 index 0000000..9d14bf4 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CallPhoneCallTransport.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CallPhoneCallTransport { + SIP("sip"), + + PSTN("pstn"); + + private final String value; + + CallPhoneCallTransport(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CallStatus.java b/src/main/java/com/vapi/api/types/CallStatus.java new file mode 100644 index 0000000..ca26897 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CallStatus.java @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CallStatus { + QUEUED("queued"), + + RINGING("ringing"), + + IN_PROGRESS("in-progress"), + + FORWARDING("forwarding"), + + ENDED("ended"); + + private final String value; + + CallStatus(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CallType.java b/src/main/java/com/vapi/api/types/CallType.java new file mode 100644 index 0000000..ef6f972 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CallType.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CallType { + INBOUND_PHONE_CALL("inboundPhoneCall"), + + OUTBOUND_PHONE_CALL("outboundPhoneCall"), + + WEB_CALL("webCall"); + + private final String value; + + CallType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CallbackStep.java b/src/main/java/com/vapi/api/types/CallbackStep.java new file mode 100644 index 0000000..a5373f0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CallbackStep.java @@ -0,0 +1,348 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CallbackStep.Builder.class) +public final class CallbackStep { + private final Optional block; + + private final Optional> mutations; + + private final String name; + + private final Optional blockId; + + private final Optional> input; + + private final Map additionalProperties; + + private CallbackStep( + Optional block, + Optional> mutations, + String name, + Optional blockId, + Optional> input, + Map additionalProperties) { + this.block = block; + this.mutations = mutations; + this.name = name; + this.blockId = blockId; + this.input = input; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the block to use. To use an existing block, use blockId. + */ + @JsonProperty("block") + public Optional getBlock() { + return block; + } + + /** + * @return This is the mutations to apply to the context after the step is done. + */ + @JsonProperty("mutations") + public Optional> getMutations() { + return mutations; + } + + /** + * @return This is the name of the step. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return This is the id of the block to use. To use a transient block, use block. + */ + @JsonProperty("blockId") + public Optional getBlockId() { + return blockId; + } + + /** + * @return This is the input to the block. You can use any key-value map as input to the block. + *

Example: + * { + * "name": "John Doe", + * "age": 20 + * }

+ *

You can reference any variable in the context of the current block:

+ *
    + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • + *
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

Example: + * { + * "name": "{{my-tool-call-step.output.name}}", + * "age": "{{my-tool-call-step.input.age}}", + * "date": "{{workflow.input.date}}" + * }

+ *

You can dynamically change the key name.

+ *

Example: + * { + * "{{my-tool-call-step.output.key-name-for-name}}": "{{name}}", + * "{{my-tool-call-step.input.key-name-for-age}}": "{{age}}", + * "{{workflow.input.key-name-for-date}}": "{{date}}" + * }

+ *

You can represent the value as a string, number, boolean, array, or object.

+ *

Example: + * { + * "name": "john", + * "age": 20, + * "date": "2021-01-01", + * "metadata": { + * "unique-key": "{{my-tool-call-step.output.unique-key}}" + * }, + * "array": ["A", "B", "C"], + * }

+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow.
  4. + *
+ */ + @JsonProperty("input") + public Optional> getInput() { + return input; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CallbackStep && equalTo((CallbackStep) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CallbackStep other) { + return block.equals(other.block) + && mutations.equals(other.mutations) + && name.equals(other.name) + && blockId.equals(other.blockId) + && input.equals(other.input); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.block, this.mutations, this.name, this.blockId, this.input); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + + Builder from(CallbackStep other); + } + + public interface _FinalStage { + CallbackStep build(); + + _FinalStage block(Optional block); + + _FinalStage block(CallbackStepBlock block); + + _FinalStage mutations(Optional> mutations); + + _FinalStage mutations(List mutations); + + _FinalStage blockId(Optional blockId); + + _FinalStage blockId(String blockId); + + _FinalStage input(Optional> input); + + _FinalStage input(Map input); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + private Optional> input = Optional.empty(); + + private Optional blockId = Optional.empty(); + + private Optional> mutations = Optional.empty(); + + private Optional block = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CallbackStep other) { + block(other.getBlock()); + mutations(other.getMutations()); + name(other.getName()); + blockId(other.getBlockId()); + input(other.getInput()); + return this; + } + + /** + *

This is the name of the step.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

This is the input to the block. You can use any key-value map as input to the block.

+ *

Example: + * { + * "name": "John Doe", + * "age": 20 + * }

+ *

You can reference any variable in the context of the current block:

+ *
    + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • + *
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

Example: + * { + * "name": "{{my-tool-call-step.output.name}}", + * "age": "{{my-tool-call-step.input.age}}", + * "date": "{{workflow.input.date}}" + * }

+ *

You can dynamically change the key name.

+ *

Example: + * { + * "{{my-tool-call-step.output.key-name-for-name}}": "{{name}}", + * "{{my-tool-call-step.input.key-name-for-age}}": "{{age}}", + * "{{workflow.input.key-name-for-date}}": "{{date}}" + * }

+ *

You can represent the value as a string, number, boolean, array, or object.

+ *

Example: + * { + * "name": "john", + * "age": 20, + * "date": "2021-01-01", + * "metadata": { + * "unique-key": "{{my-tool-call-step.output.unique-key}}" + * }, + * "array": ["A", "B", "C"], + * }

+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow.
  4. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage input(Map input) { + this.input = Optional.ofNullable(input); + return this; + } + + @java.lang.Override + @JsonSetter(value = "input", nulls = Nulls.SKIP) + public _FinalStage input(Optional> input) { + this.input = input; + return this; + } + + /** + *

This is the id of the block to use. To use a transient block, use block.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage blockId(String blockId) { + this.blockId = Optional.ofNullable(blockId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "blockId", nulls = Nulls.SKIP) + public _FinalStage blockId(Optional blockId) { + this.blockId = blockId; + return this; + } + + /** + *

This is the mutations to apply to the context after the step is done.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage mutations(List mutations) { + this.mutations = Optional.ofNullable(mutations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "mutations", nulls = Nulls.SKIP) + public _FinalStage mutations(Optional> mutations) { + this.mutations = mutations; + return this; + } + + /** + *

This is the block to use. To use an existing block, use blockId.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage block(CallbackStepBlock block) { + this.block = Optional.ofNullable(block); + return this; + } + + @java.lang.Override + @JsonSetter(value = "block", nulls = Nulls.SKIP) + public _FinalStage block(Optional block) { + this.block = block; + return this; + } + + @java.lang.Override + public CallbackStep build() { + return new CallbackStep(block, mutations, name, blockId, input, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CallbackStepBlock.java b/src/main/java/com/vapi/api/types/CallbackStepBlock.java new file mode 100644 index 0000000..68b1873 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CallbackStepBlock.java @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CallbackStepBlock { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CallbackStepBlock(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CallbackStepBlock conversation(CreateConversationBlockDto value) { + return new CallbackStepBlock(new ConversationValue(value)); + } + + public static CallbackStepBlock toolCall(CreateToolCallBlockDto value) { + return new CallbackStepBlock(new ToolCallValue(value)); + } + + public static CallbackStepBlock workflow(CreateWorkflowBlockDto value) { + return new CallbackStepBlock(new WorkflowValue(value)); + } + + public boolean isConversation() { + return value instanceof ConversationValue; + } + + public boolean isToolCall() { + return value instanceof ToolCallValue; + } + + public boolean isWorkflow() { + return value instanceof WorkflowValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getConversation() { + if (isConversation()) { + return Optional.of(((ConversationValue) value).value); + } + return Optional.empty(); + } + + public Optional getToolCall() { + if (isToolCall()) { + return Optional.of(((ToolCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getWorkflow() { + if (isWorkflow()) { + return Optional.of(((WorkflowValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitConversation(CreateConversationBlockDto conversation); + + T visitToolCall(CreateToolCallBlockDto toolCall); + + T visitWorkflow(CreateWorkflowBlockDto workflow); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ConversationValue.class), + @JsonSubTypes.Type(ToolCallValue.class), + @JsonSubTypes.Type(WorkflowValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("conversation") + private static final class ConversationValue implements Value { + @JsonUnwrapped + private CreateConversationBlockDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ConversationValue() {} + + private ConversationValue(CreateConversationBlockDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitConversation(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConversationValue && equalTo((ConversationValue) other); + } + + private boolean equalTo(ConversationValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CallbackStepBlock{" + "value: " + value + "}"; + } + } + + @JsonTypeName("tool-call") + private static final class ToolCallValue implements Value { + @JsonUnwrapped + private CreateToolCallBlockDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ToolCallValue() {} + + private ToolCallValue(CreateToolCallBlockDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitToolCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallValue && equalTo((ToolCallValue) other); + } + + private boolean equalTo(ToolCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CallbackStepBlock{" + "value: " + value + "}"; + } + } + + @JsonTypeName("workflow") + private static final class WorkflowValue implements Value { + @JsonUnwrapped + private CreateWorkflowBlockDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private WorkflowValue() {} + + private WorkflowValue(CreateWorkflowBlockDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitWorkflow(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkflowValue && equalTo((WorkflowValue) other); + } + + private boolean equalTo(WorkflowValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CallbackStepBlock{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CallbackStepBlock{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CartesiaCredential.java b/src/main/java/com/vapi/api/types/CartesiaCredential.java new file mode 100644 index 0000000..b60bbde --- /dev/null +++ b/src/main/java/com/vapi/api/types/CartesiaCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CartesiaCredential.Builder.class) +public final class CartesiaCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private CartesiaCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "cartesia"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CartesiaCredential && equalTo((CartesiaCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CartesiaCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(CartesiaCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + CartesiaCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CartesiaCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public CartesiaCredential build() { + return new CartesiaCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CartesiaVoice.java b/src/main/java/com/vapi/api/types/CartesiaVoice.java new file mode 100644 index 0000000..a2b7355 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CartesiaVoice.java @@ -0,0 +1,263 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CartesiaVoice.Builder.class) +public final class CartesiaVoice { + private final Optional fillerInjectionEnabled; + + private final Optional model; + + private final Optional language; + + private final String voiceId; + + private final Optional chunkPlan; + + private final Map additionalProperties; + + private CartesiaVoice( + Optional fillerInjectionEnabled, + Optional model, + Optional language, + String voiceId, + Optional chunkPlan, + Map additionalProperties) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + this.model = model; + this.language = language; + this.voiceId = voiceId; + this.chunkPlan = chunkPlan; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines whether fillers are injected into the model output before inputting it into the voice provider. + *

Default false because you can achieve better results with prompting the model.

+ */ + @JsonProperty("fillerInjectionEnabled") + public Optional getFillerInjectionEnabled() { + return fillerInjectionEnabled; + } + + /** + * @return This is the model that will be used. This is optional and will default to the correct model for the voiceId. + */ + @JsonProperty("model") + public Optional getModel() { + return model; + } + + /** + * @return This is the language that will be used. This is optional and will default to the correct language for the voiceId. + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + /** + * @return This is the provider-specific ID that will be used. + */ + @JsonProperty("voiceId") + public String getVoiceId() { + return voiceId; + } + + /** + * @return This is the plan for chunking the model output before it is sent to the voice provider. + */ + @JsonProperty("chunkPlan") + public Optional getChunkPlan() { + return chunkPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CartesiaVoice && equalTo((CartesiaVoice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CartesiaVoice other) { + return fillerInjectionEnabled.equals(other.fillerInjectionEnabled) + && model.equals(other.model) + && language.equals(other.language) + && voiceId.equals(other.voiceId) + && chunkPlan.equals(other.chunkPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fillerInjectionEnabled, this.model, this.language, this.voiceId, this.chunkPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VoiceIdStage builder() { + return new Builder(); + } + + public interface VoiceIdStage { + _FinalStage voiceId(@NotNull String voiceId); + + Builder from(CartesiaVoice other); + } + + public interface _FinalStage { + CartesiaVoice build(); + + _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled); + + _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled); + + _FinalStage model(Optional model); + + _FinalStage model(CartesiaVoiceModel model); + + _FinalStage language(Optional language); + + _FinalStage language(CartesiaVoiceLanguage language); + + _FinalStage chunkPlan(Optional chunkPlan); + + _FinalStage chunkPlan(ChunkPlan chunkPlan); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VoiceIdStage, _FinalStage { + private String voiceId; + + private Optional chunkPlan = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional model = Optional.empty(); + + private Optional fillerInjectionEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CartesiaVoice other) { + fillerInjectionEnabled(other.getFillerInjectionEnabled()); + model(other.getModel()); + language(other.getLanguage()); + voiceId(other.getVoiceId()); + chunkPlan(other.getChunkPlan()); + return this; + } + + /** + *

This is the provider-specific ID that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("voiceId") + public _FinalStage voiceId(@NotNull String voiceId) { + this.voiceId = Objects.requireNonNull(voiceId, "voiceId must not be null"); + return this; + } + + /** + *

This is the plan for chunking the model output before it is sent to the voice provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage chunkPlan(ChunkPlan chunkPlan) { + this.chunkPlan = Optional.ofNullable(chunkPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "chunkPlan", nulls = Nulls.SKIP) + public _FinalStage chunkPlan(Optional chunkPlan) { + this.chunkPlan = chunkPlan; + return this; + } + + /** + *

This is the language that will be used. This is optional and will default to the correct language for the voiceId.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage language(CartesiaVoiceLanguage language) { + this.language = Optional.ofNullable(language); + return this; + } + + @java.lang.Override + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public _FinalStage language(Optional language) { + this.language = language; + return this; + } + + /** + *

This is the model that will be used. This is optional and will default to the correct model for the voiceId.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage model(CartesiaVoiceModel model) { + this.model = Optional.ofNullable(model); + return this; + } + + @java.lang.Override + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public _FinalStage model(Optional model) { + this.model = model; + return this; + } + + /** + *

This determines whether fillers are injected into the model output before inputting it into the voice provider.

+ *

Default false because you can achieve better results with prompting the model.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled) { + this.fillerInjectionEnabled = Optional.ofNullable(fillerInjectionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fillerInjectionEnabled", nulls = Nulls.SKIP) + public _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + return this; + } + + @java.lang.Override + public CartesiaVoice build() { + return new CartesiaVoice(fillerInjectionEnabled, model, language, voiceId, chunkPlan, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CartesiaVoiceLanguage.java b/src/main/java/com/vapi/api/types/CartesiaVoiceLanguage.java new file mode 100644 index 0000000..566f142 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CartesiaVoiceLanguage.java @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CartesiaVoiceLanguage { + DE("de"), + + EN("en"), + + ES("es"), + + FR("fr"), + + JA("ja"), + + PT("pt"), + + ZH("zh"); + + private final String value; + + CartesiaVoiceLanguage(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CartesiaVoiceModel.java b/src/main/java/com/vapi/api/types/CartesiaVoiceModel.java new file mode 100644 index 0000000..727e0a0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CartesiaVoiceModel.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CartesiaVoiceModel { + SONIC_ENGLISH("sonic-english"), + + SONIC_MULTILINGUAL("sonic-multilingual"); + + private final String value; + + CartesiaVoiceModel(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ChunkPlan.java b/src/main/java/com/vapi/api/types/ChunkPlan.java new file mode 100644 index 0000000..955cf97 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ChunkPlan.java @@ -0,0 +1,201 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ChunkPlan.Builder.class) +public final class ChunkPlan { + private final Optional enabled; + + private final Optional minCharacters; + + private final Optional> punctuationBoundaries; + + private final Optional formatPlan; + + private final Map additionalProperties; + + private ChunkPlan( + Optional enabled, + Optional minCharacters, + Optional> punctuationBoundaries, + Optional formatPlan, + Map additionalProperties) { + this.enabled = enabled; + this.minCharacters = minCharacters; + this.punctuationBoundaries = punctuationBoundaries; + this.formatPlan = formatPlan; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines whether the model output is chunked before being sent to the voice provider. Default true. + *

Usage:

+ *
    + *
  • To rely on the voice provider's audio generation logic, set this to false.
  • + *
  • If seeing issues with quality, set this to true.
  • + *
+ *

If disabled, Vapi-provided audio control tokens like <flush /> will not work.

+ *

@default true

+ */ + @JsonProperty("enabled") + public Optional getEnabled() { + return enabled; + } + + /** + * @return This is the minimum number of characters in a chunk. + *

Usage:

+ *
    + *
  • To increase quality, set this to a higher value.
  • + *
  • To decrease latency, set this to a lower value.
  • + *
+ *

@default 30

+ */ + @JsonProperty("minCharacters") + public Optional getMinCharacters() { + return minCharacters; + } + + /** + * @return These are the punctuations that are considered valid boundaries for a chunk to be created. + *

Usage:

+ *
    + *
  • To increase quality, constrain to fewer boundaries.
  • + *
  • To decrease latency, enable all.
  • + *
+ *

Default is automatically set to balance the trade-off between quality and latency based on the provider.

+ */ + @JsonProperty("punctuationBoundaries") + public Optional> getPunctuationBoundaries() { + return punctuationBoundaries; + } + + /** + * @return This is the plan for formatting the chunk before it is sent to the voice provider. + */ + @JsonProperty("formatPlan") + public Optional getFormatPlan() { + return formatPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ChunkPlan && equalTo((ChunkPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ChunkPlan other) { + return enabled.equals(other.enabled) + && minCharacters.equals(other.minCharacters) + && punctuationBoundaries.equals(other.punctuationBoundaries) + && formatPlan.equals(other.formatPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.enabled, this.minCharacters, this.punctuationBoundaries, this.formatPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional enabled = Optional.empty(); + + private Optional minCharacters = Optional.empty(); + + private Optional> punctuationBoundaries = Optional.empty(); + + private Optional formatPlan = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ChunkPlan other) { + enabled(other.getEnabled()); + minCharacters(other.getMinCharacters()); + punctuationBoundaries(other.getPunctuationBoundaries()); + formatPlan(other.getFormatPlan()); + return this; + } + + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(Boolean enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + @JsonSetter(value = "minCharacters", nulls = Nulls.SKIP) + public Builder minCharacters(Optional minCharacters) { + this.minCharacters = minCharacters; + return this; + } + + public Builder minCharacters(Double minCharacters) { + this.minCharacters = Optional.ofNullable(minCharacters); + return this; + } + + @JsonSetter(value = "punctuationBoundaries", nulls = Nulls.SKIP) + public Builder punctuationBoundaries(Optional> punctuationBoundaries) { + this.punctuationBoundaries = punctuationBoundaries; + return this; + } + + public Builder punctuationBoundaries(List punctuationBoundaries) { + this.punctuationBoundaries = Optional.ofNullable(punctuationBoundaries); + return this; + } + + @JsonSetter(value = "formatPlan", nulls = Nulls.SKIP) + public Builder formatPlan(Optional formatPlan) { + this.formatPlan = formatPlan; + return this; + } + + public Builder formatPlan(FormatPlan formatPlan) { + this.formatPlan = Optional.ofNullable(formatPlan); + return this; + } + + public ChunkPlan build() { + return new ChunkPlan(enabled, minCharacters, punctuationBoundaries, formatPlan, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientInboundMessage.java b/src/main/java/com/vapi/api/types/ClientInboundMessage.java new file mode 100644 index 0000000..ea714a6 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientInboundMessage.java @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientInboundMessage.Builder.class) +public final class ClientInboundMessage { + private final ClientInboundMessageMessage message; + + private final Map additionalProperties; + + private ClientInboundMessage(ClientInboundMessageMessage message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the messages that can be sent from client-side SDKs to control the call. + */ + @JsonProperty("message") + public ClientInboundMessageMessage getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientInboundMessage && equalTo((ClientInboundMessage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientInboundMessage other) { + return message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + _FinalStage message(@NotNull ClientInboundMessageMessage message); + + Builder from(ClientInboundMessage other); + } + + public interface _FinalStage { + ClientInboundMessage build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, _FinalStage { + private ClientInboundMessageMessage message; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ClientInboundMessage other) { + message(other.getMessage()); + return this; + } + + /** + *

These are the messages that can be sent from client-side SDKs to control the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message") + public _FinalStage message(@NotNull ClientInboundMessageMessage message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + public ClientInboundMessage build() { + return new ClientInboundMessage(message, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientInboundMessageAddMessage.java b/src/main/java/com/vapi/api/types/ClientInboundMessageAddMessage.java new file mode 100644 index 0000000..b986761 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientInboundMessageAddMessage.java @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientInboundMessageAddMessage.Builder.class) +public final class ClientInboundMessageAddMessage { + private final OpenAiMessage message; + + private final Map additionalProperties; + + private ClientInboundMessageAddMessage(OpenAiMessage message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the message to add to the conversation. + */ + @JsonProperty("message") + public OpenAiMessage getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientInboundMessageAddMessage && equalTo((ClientInboundMessageAddMessage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientInboundMessageAddMessage other) { + return message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + _FinalStage message(@NotNull OpenAiMessage message); + + Builder from(ClientInboundMessageAddMessage other); + } + + public interface _FinalStage { + ClientInboundMessageAddMessage build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, _FinalStage { + private OpenAiMessage message; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ClientInboundMessageAddMessage other) { + message(other.getMessage()); + return this; + } + + /** + *

This is the message to add to the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message") + public _FinalStage message(@NotNull OpenAiMessage message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + public ClientInboundMessageAddMessage build() { + return new ClientInboundMessageAddMessage(message, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientInboundMessageControl.java b/src/main/java/com/vapi/api/types/ClientInboundMessageControl.java new file mode 100644 index 0000000..850b2f7 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientInboundMessageControl.java @@ -0,0 +1,110 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientInboundMessageControl.Builder.class) +public final class ClientInboundMessageControl { + private final ClientInboundMessageControlControl control; + + private final Map additionalProperties; + + private ClientInboundMessageControl( + ClientInboundMessageControlControl control, Map additionalProperties) { + this.control = control; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the control action + */ + @JsonProperty("control") + public ClientInboundMessageControlControl getControl() { + return control; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientInboundMessageControl && equalTo((ClientInboundMessageControl) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientInboundMessageControl other) { + return control.equals(other.control); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.control); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ControlStage builder() { + return new Builder(); + } + + public interface ControlStage { + _FinalStage control(@NotNull ClientInboundMessageControlControl control); + + Builder from(ClientInboundMessageControl other); + } + + public interface _FinalStage { + ClientInboundMessageControl build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ControlStage, _FinalStage { + private ClientInboundMessageControlControl control; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ClientInboundMessageControl other) { + control(other.getControl()); + return this; + } + + /** + *

This is the control action

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("control") + public _FinalStage control(@NotNull ClientInboundMessageControlControl control) { + this.control = Objects.requireNonNull(control, "control must not be null"); + return this; + } + + @java.lang.Override + public ClientInboundMessageControl build() { + return new ClientInboundMessageControl(control, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientInboundMessageControlControl.java b/src/main/java/com/vapi/api/types/ClientInboundMessageControlControl.java new file mode 100644 index 0000000..821e283 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientInboundMessageControlControl.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ClientInboundMessageControlControl { + MUTE_ASSISTANT("mute-assistant"), + + UNMUTE_ASSISTANT("unmute-assistant"), + + SAY_FIRST_MESSAGE("say-first-message"); + + private final String value; + + ClientInboundMessageControlControl(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ClientInboundMessageMessage.java b/src/main/java/com/vapi/api/types/ClientInboundMessageMessage.java new file mode 100644 index 0000000..f4b5761 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientInboundMessageMessage.java @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ClientInboundMessageMessage { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ClientInboundMessageMessage(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ClientInboundMessageMessage addMessage(ClientInboundMessageAddMessage value) { + return new ClientInboundMessageMessage(new AddMessageValue(value)); + } + + public static ClientInboundMessageMessage control(ClientInboundMessageControl value) { + return new ClientInboundMessageMessage(new ControlValue(value)); + } + + public static ClientInboundMessageMessage say(ClientInboundMessageSay value) { + return new ClientInboundMessageMessage(new SayValue(value)); + } + + public boolean isAddMessage() { + return value instanceof AddMessageValue; + } + + public boolean isControl() { + return value instanceof ControlValue; + } + + public boolean isSay() { + return value instanceof SayValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAddMessage() { + if (isAddMessage()) { + return Optional.of(((AddMessageValue) value).value); + } + return Optional.empty(); + } + + public Optional getControl() { + if (isControl()) { + return Optional.of(((ControlValue) value).value); + } + return Optional.empty(); + } + + public Optional getSay() { + if (isSay()) { + return Optional.of(((SayValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAddMessage(ClientInboundMessageAddMessage addMessage); + + T visitControl(ClientInboundMessageControl control); + + T visitSay(ClientInboundMessageSay say); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AddMessageValue.class), + @JsonSubTypes.Type(ControlValue.class), + @JsonSubTypes.Type(SayValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("add-message") + private static final class AddMessageValue implements Value { + @JsonUnwrapped + private ClientInboundMessageAddMessage value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AddMessageValue() {} + + private AddMessageValue(ClientInboundMessageAddMessage value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAddMessage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AddMessageValue && equalTo((AddMessageValue) other); + } + + private boolean equalTo(AddMessageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientInboundMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("control") + private static final class ControlValue implements Value { + @JsonUnwrapped + private ClientInboundMessageControl value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ControlValue() {} + + private ControlValue(ClientInboundMessageControl value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitControl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ControlValue && equalTo((ControlValue) other); + } + + private boolean equalTo(ControlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientInboundMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("say") + private static final class SayValue implements Value { + @JsonUnwrapped + private ClientInboundMessageSay value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SayValue() {} + + private SayValue(ClientInboundMessageSay value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSay(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SayValue && equalTo((SayValue) other); + } + + private boolean equalTo(SayValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientInboundMessageMessage{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ClientInboundMessageMessage{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientInboundMessageSay.java b/src/main/java/com/vapi/api/types/ClientInboundMessageSay.java new file mode 100644 index 0000000..a013455 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientInboundMessageSay.java @@ -0,0 +1,124 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientInboundMessageSay.Builder.class) +public final class ClientInboundMessageSay { + private final Optional content; + + private final Optional endCallAfterSpoken; + + private final Map additionalProperties; + + private ClientInboundMessageSay( + Optional content, Optional endCallAfterSpoken, Map additionalProperties) { + this.content = content; + this.endCallAfterSpoken = endCallAfterSpoken; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the content to say. + */ + @JsonProperty("content") + public Optional getContent() { + return content; + } + + /** + * @return This is the flag to end call after content is spoken. + */ + @JsonProperty("endCallAfterSpoken") + public Optional getEndCallAfterSpoken() { + return endCallAfterSpoken; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientInboundMessageSay && equalTo((ClientInboundMessageSay) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientInboundMessageSay other) { + return content.equals(other.content) && endCallAfterSpoken.equals(other.endCallAfterSpoken); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.content, this.endCallAfterSpoken); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional content = Optional.empty(); + + private Optional endCallAfterSpoken = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ClientInboundMessageSay other) { + content(other.getContent()); + endCallAfterSpoken(other.getEndCallAfterSpoken()); + return this; + } + + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public Builder content(Optional content) { + this.content = content; + return this; + } + + public Builder content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + @JsonSetter(value = "endCallAfterSpoken", nulls = Nulls.SKIP) + public Builder endCallAfterSpoken(Optional endCallAfterSpoken) { + this.endCallAfterSpoken = endCallAfterSpoken; + return this; + } + + public Builder endCallAfterSpoken(Boolean endCallAfterSpoken) { + this.endCallAfterSpoken = Optional.ofNullable(endCallAfterSpoken); + return this; + } + + public ClientInboundMessageSay build() { + return new ClientInboundMessageSay(content, endCallAfterSpoken, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessage.java b/src/main/java/com/vapi/api/types/ClientMessage.java new file mode 100644 index 0000000..77a8fc7 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessage.java @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientMessage.Builder.class) +public final class ClientMessage { + private final ClientMessageMessage message; + + private final Map additionalProperties; + + private ClientMessage(ClientMessageMessage message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are all the messages that can be sent to the client-side SDKs during the call. Configure the messages you'd like to receive in assistant.clientMessages. + */ + @JsonProperty("message") + public ClientMessageMessage getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientMessage && equalTo((ClientMessage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientMessage other) { + return message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + _FinalStage message(@NotNull ClientMessageMessage message); + + Builder from(ClientMessage other); + } + + public interface _FinalStage { + ClientMessage build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, _FinalStage { + private ClientMessageMessage message; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ClientMessage other) { + message(other.getMessage()); + return this; + } + + /** + *

These are all the messages that can be sent to the client-side SDKs during the call. Configure the messages you'd like to receive in assistant.clientMessages.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message") + public _FinalStage message(@NotNull ClientMessageMessage message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + public ClientMessage build() { + return new ClientMessage(message, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageConversationUpdate.java b/src/main/java/com/vapi/api/types/ClientMessageConversationUpdate.java new file mode 100644 index 0000000..8f8d272 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageConversationUpdate.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientMessageConversationUpdate.Builder.class) +public final class ClientMessageConversationUpdate { + private final Optional> messages; + + private final List messagesOpenAiFormatted; + + private final Map additionalProperties; + + private ClientMessageConversationUpdate( + Optional> messages, + List messagesOpenAiFormatted, + Map additionalProperties) { + this.messages = messages; + this.messagesOpenAiFormatted = messagesOpenAiFormatted; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the most up-to-date conversation history at the time the message is sent. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the most up-to-date conversation history at the time the message is sent, formatted for OpenAI. + */ + @JsonProperty("messagesOpenAIFormatted") + public List getMessagesOpenAiFormatted() { + return messagesOpenAiFormatted; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientMessageConversationUpdate && equalTo((ClientMessageConversationUpdate) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientMessageConversationUpdate other) { + return messages.equals(other.messages) && messagesOpenAiFormatted.equals(other.messagesOpenAiFormatted); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.messages, this.messagesOpenAiFormatted); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> messages = Optional.empty(); + + private List messagesOpenAiFormatted = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ClientMessageConversationUpdate other) { + messages(other.getMessages()); + messagesOpenAiFormatted(other.getMessagesOpenAiFormatted()); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "messagesOpenAIFormatted", nulls = Nulls.SKIP) + public Builder messagesOpenAiFormatted(List messagesOpenAiFormatted) { + this.messagesOpenAiFormatted.clear(); + this.messagesOpenAiFormatted.addAll(messagesOpenAiFormatted); + return this; + } + + public Builder addMessagesOpenAiFormatted(OpenAiMessage messagesOpenAiFormatted) { + this.messagesOpenAiFormatted.add(messagesOpenAiFormatted); + return this; + } + + public Builder addAllMessagesOpenAiFormatted(List messagesOpenAiFormatted) { + this.messagesOpenAiFormatted.addAll(messagesOpenAiFormatted); + return this; + } + + public ClientMessageConversationUpdate build() { + return new ClientMessageConversationUpdate(messages, messagesOpenAiFormatted, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageConversationUpdateMessagesItem.java b/src/main/java/com/vapi/api/types/ClientMessageConversationUpdateMessagesItem.java new file mode 100644 index 0000000..1daab08 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageConversationUpdateMessagesItem.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.vapi.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = ClientMessageConversationUpdateMessagesItem.Deserializer.class) +public final class ClientMessageConversationUpdateMessagesItem { + private final Object value; + + private final int type; + + private ClientMessageConversationUpdateMessagesItem(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((UserMessage) this.value); + } else if (this.type == 1) { + return visitor.visit((SystemMessage) this.value); + } else if (this.type == 2) { + return visitor.visit((BotMessage) this.value); + } else if (this.type == 3) { + return visitor.visit((ToolCallMessage) this.value); + } else if (this.type == 4) { + return visitor.visit((ToolCallResultMessage) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientMessageConversationUpdateMessagesItem + && equalTo((ClientMessageConversationUpdateMessagesItem) other); + } + + private boolean equalTo(ClientMessageConversationUpdateMessagesItem other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static ClientMessageConversationUpdateMessagesItem of(UserMessage value) { + return new ClientMessageConversationUpdateMessagesItem(value, 0); + } + + public static ClientMessageConversationUpdateMessagesItem of(SystemMessage value) { + return new ClientMessageConversationUpdateMessagesItem(value, 1); + } + + public static ClientMessageConversationUpdateMessagesItem of(BotMessage value) { + return new ClientMessageConversationUpdateMessagesItem(value, 2); + } + + public static ClientMessageConversationUpdateMessagesItem of(ToolCallMessage value) { + return new ClientMessageConversationUpdateMessagesItem(value, 3); + } + + public static ClientMessageConversationUpdateMessagesItem of(ToolCallResultMessage value) { + return new ClientMessageConversationUpdateMessagesItem(value, 4); + } + + public interface Visitor { + T visit(UserMessage value); + + T visit(SystemMessage value); + + T visit(BotMessage value); + + T visit(ToolCallMessage value); + + T visit(ToolCallResultMessage value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(ClientMessageConversationUpdateMessagesItem.class); + } + + @java.lang.Override + public ClientMessageConversationUpdateMessagesItem deserialize(JsonParser p, DeserializationContext ctxt) + throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, UserMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, SystemMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, BotMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ToolCallMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ToolCallResultMessage.class)); + } catch (IllegalArgumentException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageHang.java b/src/main/java/com/vapi/api/types/ClientMessageHang.java new file mode 100644 index 0000000..0fa9db3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageHang.java @@ -0,0 +1,59 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientMessageHang.Builder.class) +public final class ClientMessageHang { + private final Map additionalProperties; + + private ClientMessageHang(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientMessageHang; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ClientMessageHang other) { + return this; + } + + public ClientMessageHang build() { + return new ClientMessageHang(additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageLanguageChanged.java b/src/main/java/com/vapi/api/types/ClientMessageLanguageChanged.java new file mode 100644 index 0000000..c747a9c --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageLanguageChanged.java @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientMessageLanguageChanged.Builder.class) +public final class ClientMessageLanguageChanged { + private final String language; + + private final Map additionalProperties; + + private ClientMessageLanguageChanged(String language, Map additionalProperties) { + this.language = language; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the language the transcriber is switched to. + */ + @JsonProperty("language") + public String getLanguage() { + return language; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientMessageLanguageChanged && equalTo((ClientMessageLanguageChanged) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientMessageLanguageChanged other) { + return language.equals(other.language); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.language); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LanguageStage builder() { + return new Builder(); + } + + public interface LanguageStage { + _FinalStage language(@NotNull String language); + + Builder from(ClientMessageLanguageChanged other); + } + + public interface _FinalStage { + ClientMessageLanguageChanged build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LanguageStage, _FinalStage { + private String language; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ClientMessageLanguageChanged other) { + language(other.getLanguage()); + return this; + } + + /** + *

This is the language the transcriber is switched to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("language") + public _FinalStage language(@NotNull String language) { + this.language = Objects.requireNonNull(language, "language must not be null"); + return this; + } + + @java.lang.Override + public ClientMessageLanguageChanged build() { + return new ClientMessageLanguageChanged(language, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageMessage.java b/src/main/java/com/vapi/api/types/ClientMessageMessage.java new file mode 100644 index 0000000..3a7cef6 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageMessage.java @@ -0,0 +1,707 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ClientMessageMessage { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ClientMessageMessage(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ClientMessageMessage conversationUpdate(ClientMessageConversationUpdate value) { + return new ClientMessageMessage(new ConversationUpdateValue(value)); + } + + public static ClientMessageMessage hang(ClientMessageHang value) { + return new ClientMessageMessage(new HangValue(value)); + } + + public static ClientMessageMessage metadata(ClientMessageMetadata value) { + return new ClientMessageMessage(new MetadataValue(value)); + } + + public static ClientMessageMessage modelOutput(ClientMessageModelOutput value) { + return new ClientMessageMessage(new ModelOutputValue(value)); + } + + public static ClientMessageMessage speechUpdate(ClientMessageSpeechUpdate value) { + return new ClientMessageMessage(new SpeechUpdateValue(value)); + } + + public static ClientMessageMessage transcript(ClientMessageTranscript value) { + return new ClientMessageMessage(new TranscriptValue(value)); + } + + public static ClientMessageMessage toolCalls(ClientMessageToolCalls value) { + return new ClientMessageMessage(new ToolCallsValue(value)); + } + + public static ClientMessageMessage toolCallsResult(ClientMessageToolCallsResult value) { + return new ClientMessageMessage(new ToolCallsResultValue(value)); + } + + public static ClientMessageMessage userInterrupted(ClientMessageUserInterrupted value) { + return new ClientMessageMessage(new UserInterruptedValue(value)); + } + + public static ClientMessageMessage languageChanged(ClientMessageLanguageChanged value) { + return new ClientMessageMessage(new LanguageChangedValue(value)); + } + + public static ClientMessageMessage voiceInput(ClientMessageVoiceInput value) { + return new ClientMessageMessage(new VoiceInputValue(value)); + } + + public boolean isConversationUpdate() { + return value instanceof ConversationUpdateValue; + } + + public boolean isHang() { + return value instanceof HangValue; + } + + public boolean isMetadata() { + return value instanceof MetadataValue; + } + + public boolean isModelOutput() { + return value instanceof ModelOutputValue; + } + + public boolean isSpeechUpdate() { + return value instanceof SpeechUpdateValue; + } + + public boolean isTranscript() { + return value instanceof TranscriptValue; + } + + public boolean isToolCalls() { + return value instanceof ToolCallsValue; + } + + public boolean isToolCallsResult() { + return value instanceof ToolCallsResultValue; + } + + public boolean isUserInterrupted() { + return value instanceof UserInterruptedValue; + } + + public boolean isLanguageChanged() { + return value instanceof LanguageChangedValue; + } + + public boolean isVoiceInput() { + return value instanceof VoiceInputValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getConversationUpdate() { + if (isConversationUpdate()) { + return Optional.of(((ConversationUpdateValue) value).value); + } + return Optional.empty(); + } + + public Optional getHang() { + if (isHang()) { + return Optional.of(((HangValue) value).value); + } + return Optional.empty(); + } + + public Optional getMetadata() { + if (isMetadata()) { + return Optional.of(((MetadataValue) value).value); + } + return Optional.empty(); + } + + public Optional getModelOutput() { + if (isModelOutput()) { + return Optional.of(((ModelOutputValue) value).value); + } + return Optional.empty(); + } + + public Optional getSpeechUpdate() { + if (isSpeechUpdate()) { + return Optional.of(((SpeechUpdateValue) value).value); + } + return Optional.empty(); + } + + public Optional getTranscript() { + if (isTranscript()) { + return Optional.of(((TranscriptValue) value).value); + } + return Optional.empty(); + } + + public Optional getToolCalls() { + if (isToolCalls()) { + return Optional.of(((ToolCallsValue) value).value); + } + return Optional.empty(); + } + + public Optional getToolCallsResult() { + if (isToolCallsResult()) { + return Optional.of(((ToolCallsResultValue) value).value); + } + return Optional.empty(); + } + + public Optional getUserInterrupted() { + if (isUserInterrupted()) { + return Optional.of(((UserInterruptedValue) value).value); + } + return Optional.empty(); + } + + public Optional getLanguageChanged() { + if (isLanguageChanged()) { + return Optional.of(((LanguageChangedValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoiceInput() { + if (isVoiceInput()) { + return Optional.of(((VoiceInputValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitConversationUpdate(ClientMessageConversationUpdate conversationUpdate); + + T visitHang(ClientMessageHang hang); + + T visitMetadata(ClientMessageMetadata metadata); + + T visitModelOutput(ClientMessageModelOutput modelOutput); + + T visitSpeechUpdate(ClientMessageSpeechUpdate speechUpdate); + + T visitTranscript(ClientMessageTranscript transcript); + + T visitToolCalls(ClientMessageToolCalls toolCalls); + + T visitToolCallsResult(ClientMessageToolCallsResult toolCallsResult); + + T visitUserInterrupted(ClientMessageUserInterrupted userInterrupted); + + T visitLanguageChanged(ClientMessageLanguageChanged languageChanged); + + T visitVoiceInput(ClientMessageVoiceInput voiceInput); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ConversationUpdateValue.class), + @JsonSubTypes.Type(HangValue.class), + @JsonSubTypes.Type(MetadataValue.class), + @JsonSubTypes.Type(ModelOutputValue.class), + @JsonSubTypes.Type(SpeechUpdateValue.class), + @JsonSubTypes.Type(TranscriptValue.class), + @JsonSubTypes.Type(ToolCallsValue.class), + @JsonSubTypes.Type(ToolCallsResultValue.class), + @JsonSubTypes.Type(UserInterruptedValue.class), + @JsonSubTypes.Type(LanguageChangedValue.class), + @JsonSubTypes.Type(VoiceInputValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("conversation-update") + private static final class ConversationUpdateValue implements Value { + @JsonUnwrapped + private ClientMessageConversationUpdate value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ConversationUpdateValue() {} + + private ConversationUpdateValue(ClientMessageConversationUpdate value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitConversationUpdate(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConversationUpdateValue && equalTo((ConversationUpdateValue) other); + } + + private boolean equalTo(ConversationUpdateValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("hang") + private static final class HangValue implements Value { + @JsonUnwrapped + private ClientMessageHang value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private HangValue() {} + + private HangValue(ClientMessageHang value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitHang(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof HangValue && equalTo((HangValue) other); + } + + private boolean equalTo(HangValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("metadata") + private static final class MetadataValue implements Value { + @JsonUnwrapped + private ClientMessageMetadata value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MetadataValue() {} + + private MetadataValue(ClientMessageMetadata value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMetadata(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MetadataValue && equalTo((MetadataValue) other); + } + + private boolean equalTo(MetadataValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("model-output") + private static final class ModelOutputValue implements Value { + @JsonUnwrapped + private ClientMessageModelOutput value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ModelOutputValue() {} + + private ModelOutputValue(ClientMessageModelOutput value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitModelOutput(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ModelOutputValue && equalTo((ModelOutputValue) other); + } + + private boolean equalTo(ModelOutputValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("speech-update") + private static final class SpeechUpdateValue implements Value { + @JsonUnwrapped + private ClientMessageSpeechUpdate value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SpeechUpdateValue() {} + + private SpeechUpdateValue(ClientMessageSpeechUpdate value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSpeechUpdate(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SpeechUpdateValue && equalTo((SpeechUpdateValue) other); + } + + private boolean equalTo(SpeechUpdateValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transcript") + private static final class TranscriptValue implements Value { + @JsonUnwrapped + private ClientMessageTranscript value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TranscriptValue() {} + + private TranscriptValue(ClientMessageTranscript value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTranscript(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TranscriptValue && equalTo((TranscriptValue) other); + } + + private boolean equalTo(TranscriptValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("tool-calls") + private static final class ToolCallsValue implements Value { + @JsonUnwrapped + private ClientMessageToolCalls value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ToolCallsValue() {} + + private ToolCallsValue(ClientMessageToolCalls value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitToolCalls(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallsValue && equalTo((ToolCallsValue) other); + } + + private boolean equalTo(ToolCallsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("tool-calls-result") + private static final class ToolCallsResultValue implements Value { + @JsonUnwrapped + private ClientMessageToolCallsResult value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ToolCallsResultValue() {} + + private ToolCallsResultValue(ClientMessageToolCallsResult value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitToolCallsResult(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallsResultValue && equalTo((ToolCallsResultValue) other); + } + + private boolean equalTo(ToolCallsResultValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("user-interrupted") + private static final class UserInterruptedValue implements Value { + @JsonUnwrapped + private ClientMessageUserInterrupted value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserInterruptedValue() {} + + private UserInterruptedValue(ClientMessageUserInterrupted value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUserInterrupted(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserInterruptedValue && equalTo((UserInterruptedValue) other); + } + + private boolean equalTo(UserInterruptedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("language-changed") + private static final class LanguageChangedValue implements Value { + @JsonUnwrapped + private ClientMessageLanguageChanged value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private LanguageChangedValue() {} + + private LanguageChangedValue(ClientMessageLanguageChanged value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitLanguageChanged(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LanguageChangedValue && equalTo((LanguageChangedValue) other); + } + + private boolean equalTo(LanguageChangedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voice-input") + private static final class VoiceInputValue implements Value { + @JsonUnwrapped + private ClientMessageVoiceInput value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoiceInputValue() {} + + private VoiceInputValue(ClientMessageVoiceInput value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoiceInput(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoiceInputValue && equalTo((VoiceInputValue) other); + } + + private boolean equalTo(VoiceInputValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageMessage{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageMessage{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageMetadata.java b/src/main/java/com/vapi/api/types/ClientMessageMetadata.java new file mode 100644 index 0000000..7860e17 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageMetadata.java @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientMessageMetadata.Builder.class) +public final class ClientMessageMetadata { + private final String metadata; + + private final Map additionalProperties; + + private ClientMessageMetadata(String metadata, Map additionalProperties) { + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the metadata content + */ + @JsonProperty("metadata") + public String getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientMessageMetadata && equalTo((ClientMessageMetadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientMessageMetadata other) { + return metadata.equals(other.metadata); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.metadata); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MetadataStage builder() { + return new Builder(); + } + + public interface MetadataStage { + _FinalStage metadata(@NotNull String metadata); + + Builder from(ClientMessageMetadata other); + } + + public interface _FinalStage { + ClientMessageMetadata build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MetadataStage, _FinalStage { + private String metadata; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ClientMessageMetadata other) { + metadata(other.getMetadata()); + return this; + } + + /** + *

This is the metadata content

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("metadata") + public _FinalStage metadata(@NotNull String metadata) { + this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); + return this; + } + + @java.lang.Override + public ClientMessageMetadata build() { + return new ClientMessageMetadata(metadata, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageModelOutput.java b/src/main/java/com/vapi/api/types/ClientMessageModelOutput.java new file mode 100644 index 0000000..a5ca411 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageModelOutput.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientMessageModelOutput.Builder.class) +public final class ClientMessageModelOutput { + private final Map output; + + private final Map additionalProperties; + + private ClientMessageModelOutput(Map output, Map additionalProperties) { + this.output = output; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the output of the model. It can be a token or tool call. + */ + @JsonProperty("output") + public Map getOutput() { + return output; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientMessageModelOutput && equalTo((ClientMessageModelOutput) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientMessageModelOutput other) { + return output.equals(other.output); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.output); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Map output = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ClientMessageModelOutput other) { + output(other.getOutput()); + return this; + } + + @JsonSetter(value = "output", nulls = Nulls.SKIP) + public Builder output(Map output) { + this.output.clear(); + this.output.putAll(output); + return this; + } + + public Builder putAllOutput(Map output) { + this.output.putAll(output); + return this; + } + + public Builder output(String key, Object value) { + this.output.put(key, value); + return this; + } + + public ClientMessageModelOutput build() { + return new ClientMessageModelOutput(output, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageSpeechUpdate.java b/src/main/java/com/vapi/api/types/ClientMessageSpeechUpdate.java new file mode 100644 index 0000000..7eedae5 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageSpeechUpdate.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientMessageSpeechUpdate.Builder.class) +public final class ClientMessageSpeechUpdate { + private final ClientMessageSpeechUpdateStatus status; + + private final ClientMessageSpeechUpdateRole role; + + private final Map additionalProperties; + + private ClientMessageSpeechUpdate( + ClientMessageSpeechUpdateStatus status, + ClientMessageSpeechUpdateRole role, + Map additionalProperties) { + this.status = status; + this.role = role; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the status of the speech update. + */ + @JsonProperty("status") + public ClientMessageSpeechUpdateStatus getStatus() { + return status; + } + + /** + * @return This is the role which the speech update is for. + */ + @JsonProperty("role") + public ClientMessageSpeechUpdateRole getRole() { + return role; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientMessageSpeechUpdate && equalTo((ClientMessageSpeechUpdate) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientMessageSpeechUpdate other) { + return status.equals(other.status) && role.equals(other.role); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.status, this.role); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StatusStage builder() { + return new Builder(); + } + + public interface StatusStage { + RoleStage status(@NotNull ClientMessageSpeechUpdateStatus status); + + Builder from(ClientMessageSpeechUpdate other); + } + + public interface RoleStage { + _FinalStage role(@NotNull ClientMessageSpeechUpdateRole role); + } + + public interface _FinalStage { + ClientMessageSpeechUpdate build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StatusStage, RoleStage, _FinalStage { + private ClientMessageSpeechUpdateStatus status; + + private ClientMessageSpeechUpdateRole role; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ClientMessageSpeechUpdate other) { + status(other.getStatus()); + role(other.getRole()); + return this; + } + + /** + *

This is the status of the speech update.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public RoleStage status(@NotNull ClientMessageSpeechUpdateStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

This is the role which the speech update is for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("role") + public _FinalStage role(@NotNull ClientMessageSpeechUpdateRole role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + @java.lang.Override + public ClientMessageSpeechUpdate build() { + return new ClientMessageSpeechUpdate(status, role, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageSpeechUpdateRole.java b/src/main/java/com/vapi/api/types/ClientMessageSpeechUpdateRole.java new file mode 100644 index 0000000..db6f0b9 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageSpeechUpdateRole.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ClientMessageSpeechUpdateRole { + ASSISTANT("assistant"), + + USER("user"); + + private final String value; + + ClientMessageSpeechUpdateRole(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageSpeechUpdateStatus.java b/src/main/java/com/vapi/api/types/ClientMessageSpeechUpdateStatus.java new file mode 100644 index 0000000..bb579c5 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageSpeechUpdateStatus.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ClientMessageSpeechUpdateStatus { + STARTED("started"), + + STOPPED("stopped"); + + private final String value; + + ClientMessageSpeechUpdateStatus(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageToolCalls.java b/src/main/java/com/vapi/api/types/ClientMessageToolCalls.java new file mode 100644 index 0000000..a7a70ba --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageToolCalls.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientMessageToolCalls.Builder.class) +public final class ClientMessageToolCalls { + private final List toolWithToolCallList; + + private final List toolCallList; + + private final Map additionalProperties; + + private ClientMessageToolCalls( + List toolWithToolCallList, + List toolCallList, + Map additionalProperties) { + this.toolWithToolCallList = toolWithToolCallList; + this.toolCallList = toolCallList; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the list of tools calls that the model is requesting along with the original tool configuration. + */ + @JsonProperty("toolWithToolCallList") + public List getToolWithToolCallList() { + return toolWithToolCallList; + } + + /** + * @return This is the list of tool calls that the model is requesting. + */ + @JsonProperty("toolCallList") + public List getToolCallList() { + return toolCallList; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientMessageToolCalls && equalTo((ClientMessageToolCalls) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientMessageToolCalls other) { + return toolWithToolCallList.equals(other.toolWithToolCallList) && toolCallList.equals(other.toolCallList); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.toolWithToolCallList, this.toolCallList); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List toolWithToolCallList = new ArrayList<>(); + + private List toolCallList = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ClientMessageToolCalls other) { + toolWithToolCallList(other.getToolWithToolCallList()); + toolCallList(other.getToolCallList()); + return this; + } + + @JsonSetter(value = "toolWithToolCallList", nulls = Nulls.SKIP) + public Builder toolWithToolCallList(List toolWithToolCallList) { + this.toolWithToolCallList.clear(); + this.toolWithToolCallList.addAll(toolWithToolCallList); + return this; + } + + public Builder addToolWithToolCallList(ClientMessageToolCallsToolWithToolCallListItem toolWithToolCallList) { + this.toolWithToolCallList.add(toolWithToolCallList); + return this; + } + + public Builder addAllToolWithToolCallList( + List toolWithToolCallList) { + this.toolWithToolCallList.addAll(toolWithToolCallList); + return this; + } + + @JsonSetter(value = "toolCallList", nulls = Nulls.SKIP) + public Builder toolCallList(List toolCallList) { + this.toolCallList.clear(); + this.toolCallList.addAll(toolCallList); + return this; + } + + public Builder addToolCallList(ToolCall toolCallList) { + this.toolCallList.add(toolCallList); + return this; + } + + public Builder addAllToolCallList(List toolCallList) { + this.toolCallList.addAll(toolCallList); + return this; + } + + public ClientMessageToolCalls build() { + return new ClientMessageToolCalls(toolWithToolCallList, toolCallList, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageToolCallsResult.java b/src/main/java/com/vapi/api/types/ClientMessageToolCallsResult.java new file mode 100644 index 0000000..a2f1b70 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageToolCallsResult.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientMessageToolCallsResult.Builder.class) +public final class ClientMessageToolCallsResult { + private final Map toolCallResult; + + private final Map additionalProperties; + + private ClientMessageToolCallsResult(Map toolCallResult, Map additionalProperties) { + this.toolCallResult = toolCallResult; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the result of the tool call. + */ + @JsonProperty("toolCallResult") + public Map getToolCallResult() { + return toolCallResult; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientMessageToolCallsResult && equalTo((ClientMessageToolCallsResult) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientMessageToolCallsResult other) { + return toolCallResult.equals(other.toolCallResult); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.toolCallResult); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Map toolCallResult = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ClientMessageToolCallsResult other) { + toolCallResult(other.getToolCallResult()); + return this; + } + + @JsonSetter(value = "toolCallResult", nulls = Nulls.SKIP) + public Builder toolCallResult(Map toolCallResult) { + this.toolCallResult.clear(); + this.toolCallResult.putAll(toolCallResult); + return this; + } + + public Builder putAllToolCallResult(Map toolCallResult) { + this.toolCallResult.putAll(toolCallResult); + return this; + } + + public Builder toolCallResult(String key, Object value) { + this.toolCallResult.put(key, value); + return this; + } + + public ClientMessageToolCallsResult build() { + return new ClientMessageToolCallsResult(toolCallResult, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageToolCallsToolWithToolCallListItem.java b/src/main/java/com/vapi/api/types/ClientMessageToolCallsToolWithToolCallListItem.java new file mode 100644 index 0000000..633ccf2 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageToolCallsToolWithToolCallListItem.java @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ClientMessageToolCallsToolWithToolCallListItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ClientMessageToolCallsToolWithToolCallListItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ClientMessageToolCallsToolWithToolCallListItem function(FunctionToolWithToolCall value) { + return new ClientMessageToolCallsToolWithToolCallListItem(new FunctionValue(value)); + } + + public static ClientMessageToolCallsToolWithToolCallListItem ghl(GhlToolWithToolCall value) { + return new ClientMessageToolCallsToolWithToolCallListItem(new GhlValue(value)); + } + + public static ClientMessageToolCallsToolWithToolCallListItem make(MakeToolWithToolCall value) { + return new ClientMessageToolCallsToolWithToolCallListItem(new MakeValue(value)); + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitFunction(FunctionToolWithToolCall function); + + T visitGhl(GhlToolWithToolCall ghl); + + T visitMake(MakeToolWithToolCall make); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private FunctionToolWithToolCall value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(FunctionToolWithToolCall value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageToolCallsToolWithToolCallListItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private GhlToolWithToolCall value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(GhlToolWithToolCall value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageToolCallsToolWithToolCallListItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private MakeToolWithToolCall value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(MakeToolWithToolCall value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageToolCallsToolWithToolCallListItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ClientMessageToolCallsToolWithToolCallListItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageTranscript.java b/src/main/java/com/vapi/api/types/ClientMessageTranscript.java new file mode 100644 index 0000000..f56bf21 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageTranscript.java @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientMessageTranscript.Builder.class) +public final class ClientMessageTranscript { + private final ClientMessageTranscriptRole role; + + private final ClientMessageTranscriptTranscriptType transcriptType; + + private final String transcript; + + private final Map additionalProperties; + + private ClientMessageTranscript( + ClientMessageTranscriptRole role, + ClientMessageTranscriptTranscriptType transcriptType, + String transcript, + Map additionalProperties) { + this.role = role; + this.transcriptType = transcriptType; + this.transcript = transcript; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the role for which the transcript is for. + */ + @JsonProperty("role") + public ClientMessageTranscriptRole getRole() { + return role; + } + + /** + * @return This is the type of the transcript. + */ + @JsonProperty("transcriptType") + public ClientMessageTranscriptTranscriptType getTranscriptType() { + return transcriptType; + } + + /** + * @return This is the transcript content. + */ + @JsonProperty("transcript") + public String getTranscript() { + return transcript; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientMessageTranscript && equalTo((ClientMessageTranscript) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientMessageTranscript other) { + return role.equals(other.role) + && transcriptType.equals(other.transcriptType) + && transcript.equals(other.transcript); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.role, this.transcriptType, this.transcript); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RoleStage builder() { + return new Builder(); + } + + public interface RoleStage { + TranscriptTypeStage role(@NotNull ClientMessageTranscriptRole role); + + Builder from(ClientMessageTranscript other); + } + + public interface TranscriptTypeStage { + TranscriptStage transcriptType(@NotNull ClientMessageTranscriptTranscriptType transcriptType); + } + + public interface TranscriptStage { + _FinalStage transcript(@NotNull String transcript); + } + + public interface _FinalStage { + ClientMessageTranscript build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RoleStage, TranscriptTypeStage, TranscriptStage, _FinalStage { + private ClientMessageTranscriptRole role; + + private ClientMessageTranscriptTranscriptType transcriptType; + + private String transcript; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ClientMessageTranscript other) { + role(other.getRole()); + transcriptType(other.getTranscriptType()); + transcript(other.getTranscript()); + return this; + } + + /** + *

This is the role for which the transcript is for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("role") + public TranscriptTypeStage role(@NotNull ClientMessageTranscriptRole role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + /** + *

This is the type of the transcript.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("transcriptType") + public TranscriptStage transcriptType(@NotNull ClientMessageTranscriptTranscriptType transcriptType) { + this.transcriptType = Objects.requireNonNull(transcriptType, "transcriptType must not be null"); + return this; + } + + /** + *

This is the transcript content.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("transcript") + public _FinalStage transcript(@NotNull String transcript) { + this.transcript = Objects.requireNonNull(transcript, "transcript must not be null"); + return this; + } + + @java.lang.Override + public ClientMessageTranscript build() { + return new ClientMessageTranscript(role, transcriptType, transcript, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageTranscriptRole.java b/src/main/java/com/vapi/api/types/ClientMessageTranscriptRole.java new file mode 100644 index 0000000..0b979a3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageTranscriptRole.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ClientMessageTranscriptRole { + ASSISTANT("assistant"), + + USER("user"); + + private final String value; + + ClientMessageTranscriptRole(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageTranscriptTranscriptType.java b/src/main/java/com/vapi/api/types/ClientMessageTranscriptTranscriptType.java new file mode 100644 index 0000000..6cee748 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageTranscriptTranscriptType.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ClientMessageTranscriptTranscriptType { + PARTIAL("partial"), + + FINAL("final"); + + private final String value; + + ClientMessageTranscriptTranscriptType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageUserInterrupted.java b/src/main/java/com/vapi/api/types/ClientMessageUserInterrupted.java new file mode 100644 index 0000000..d5bba6a --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageUserInterrupted.java @@ -0,0 +1,59 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientMessageUserInterrupted.Builder.class) +public final class ClientMessageUserInterrupted { + private final Map additionalProperties; + + private ClientMessageUserInterrupted(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientMessageUserInterrupted; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ClientMessageUserInterrupted other) { + return this; + } + + public ClientMessageUserInterrupted build() { + return new ClientMessageUserInterrupted(additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ClientMessageVoiceInput.java b/src/main/java/com/vapi/api/types/ClientMessageVoiceInput.java new file mode 100644 index 0000000..c26954f --- /dev/null +++ b/src/main/java/com/vapi/api/types/ClientMessageVoiceInput.java @@ -0,0 +1,109 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientMessageVoiceInput.Builder.class) +public final class ClientMessageVoiceInput { + private final String input; + + private final Map additionalProperties; + + private ClientMessageVoiceInput(String input, Map additionalProperties) { + this.input = input; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the voice input content + */ + @JsonProperty("input") + public String getInput() { + return input; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientMessageVoiceInput && equalTo((ClientMessageVoiceInput) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientMessageVoiceInput other) { + return input.equals(other.input); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.input); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static InputStage builder() { + return new Builder(); + } + + public interface InputStage { + _FinalStage input(@NotNull String input); + + Builder from(ClientMessageVoiceInput other); + } + + public interface _FinalStage { + ClientMessageVoiceInput build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements InputStage, _FinalStage { + private String input; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ClientMessageVoiceInput other) { + input(other.getInput()); + return this; + } + + /** + *

This is the voice input content

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("input") + public _FinalStage input(@NotNull String input) { + this.input = Objects.requireNonNull(input, "input must not be null"); + return this; + } + + @java.lang.Override + public ClientMessageVoiceInput build() { + return new ClientMessageVoiceInput(input, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CloneVoiceDto.java b/src/main/java/com/vapi/api/types/CloneVoiceDto.java new file mode 100644 index 0000000..d2888c9 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CloneVoiceDto.java @@ -0,0 +1,239 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CloneVoiceDto.Builder.class) +public final class CloneVoiceDto { + private final String name; + + private final Optional description; + + private final Optional labels; + + private final List files; + + private final Map additionalProperties; + + private CloneVoiceDto( + String name, + Optional description, + Optional labels, + List files, + Map additionalProperties) { + this.name = name; + this.description = description; + this.labels = labels; + this.files = files; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the name of the cloned voice in the provider account. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return This is the description of your cloned voice. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return Serialized labels dictionary for the voice. + */ + @JsonProperty("labels") + public Optional getLabels() { + return labels; + } + + /** + * @return These are the files you want to use to clone your voice. Only Audio files are supported. + */ + @JsonProperty("files") + public List getFiles() { + return files; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CloneVoiceDto && equalTo((CloneVoiceDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CloneVoiceDto other) { + return name.equals(other.name) + && description.equals(other.description) + && labels.equals(other.labels) + && files.equals(other.files); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.description, this.labels, this.files); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + + Builder from(CloneVoiceDto other); + } + + public interface _FinalStage { + CloneVoiceDto build(); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage labels(Optional labels); + + _FinalStage labels(String labels); + + _FinalStage files(List files); + + _FinalStage addFiles(String files); + + _FinalStage addAllFiles(List files); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + private List files = new ArrayList<>(); + + private Optional labels = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CloneVoiceDto other) { + name(other.getName()); + description(other.getDescription()); + labels(other.getLabels()); + files(other.getFiles()); + return this; + } + + /** + *

This is the name of the cloned voice in the provider account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

These are the files you want to use to clone your voice. Only Audio files are supported.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllFiles(List files) { + this.files.addAll(files); + return this; + } + + /** + *

These are the files you want to use to clone your voice. Only Audio files are supported.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addFiles(String files) { + this.files.add(files); + return this; + } + + @java.lang.Override + @JsonSetter(value = "files", nulls = Nulls.SKIP) + public _FinalStage files(List files) { + this.files.clear(); + this.files.addAll(files); + return this; + } + + /** + *

Serialized labels dictionary for the voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage labels(String labels) { + this.labels = Optional.ofNullable(labels); + return this; + } + + @java.lang.Override + @JsonSetter(value = "labels", nulls = Nulls.SKIP) + public _FinalStage labels(Optional labels) { + this.labels = labels; + return this; + } + + /** + *

This is the description of your cloned voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public CloneVoiceDto build() { + return new CloneVoiceDto(name, description, labels, files, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/Condition.java b/src/main/java/com/vapi/api/types/Condition.java new file mode 100644 index 0000000..b610ebe --- /dev/null +++ b/src/main/java/com/vapi/api/types/Condition.java @@ -0,0 +1,168 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Condition.Builder.class) +public final class Condition { + private final String value; + + private final ConditionOperator operator; + + private final String param; + + private final Map additionalProperties; + + private Condition( + String value, ConditionOperator operator, String param, Map additionalProperties) { + this.value = value; + this.operator = operator; + this.param = param; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the value you want to compare against the parameter. + */ + @JsonProperty("value") + public String getValue() { + return value; + } + + /** + * @return This is the operator you want to use to compare the parameter and value. + */ + @JsonProperty("operator") + public ConditionOperator getOperator() { + return operator; + } + + /** + * @return This is the name of the parameter that you want to check. + */ + @JsonProperty("param") + public String getParam() { + return param; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Condition && equalTo((Condition) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Condition other) { + return value.equals(other.value) && operator.equals(other.operator) && param.equals(other.param); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value, this.operator, this.param); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ValueStage builder() { + return new Builder(); + } + + public interface ValueStage { + OperatorStage value(@NotNull String value); + + Builder from(Condition other); + } + + public interface OperatorStage { + ParamStage operator(@NotNull ConditionOperator operator); + } + + public interface ParamStage { + _FinalStage param(@NotNull String param); + } + + public interface _FinalStage { + Condition build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ValueStage, OperatorStage, ParamStage, _FinalStage { + private String value; + + private ConditionOperator operator; + + private String param; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Condition other) { + value(other.getValue()); + operator(other.getOperator()); + param(other.getParam()); + return this; + } + + /** + *

This is the value you want to compare against the parameter.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("value") + public OperatorStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + /** + *

This is the operator you want to use to compare the parameter and value.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("operator") + public ParamStage operator(@NotNull ConditionOperator operator) { + this.operator = Objects.requireNonNull(operator, "operator must not be null"); + return this; + } + + /** + *

This is the name of the parameter that you want to check.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("param") + public _FinalStage param(@NotNull String param) { + this.param = Objects.requireNonNull(param, "param must not be null"); + return this; + } + + @java.lang.Override + public Condition build() { + return new Condition(value, operator, param, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ConditionOperator.java b/src/main/java/com/vapi/api/types/ConditionOperator.java new file mode 100644 index 0000000..d15a0ad --- /dev/null +++ b/src/main/java/com/vapi/api/types/ConditionOperator.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ConditionOperator { + EQ("eq"), + + NEQ("neq"), + + GT("gt"), + + GTE("gte"), + + LT("lt"), + + LTE("lte"); + + private final String value; + + ConditionOperator(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ConversationBlock.java b/src/main/java/com/vapi/api/types/ConversationBlock.java new file mode 100644 index 0000000..35f665e --- /dev/null +++ b/src/main/java/com/vapi/api/types/ConversationBlock.java @@ -0,0 +1,481 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConversationBlock.Builder.class) +public final class ConversationBlock { + private final Optional> messages; + + private final Optional inputSchema; + + private final Optional outputSchema; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional name; + + private final String instruction; + + private final Map additionalProperties; + + private ConversationBlock( + Optional> messages, + Optional inputSchema, + Optional outputSchema, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional name, + String instruction, + Map additionalProperties) { + this.messages = messages; + this.inputSchema = inputSchema; + this.outputSchema = outputSchema; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.name = name; + this.instruction = instruction; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the pre-configured messages that will be spoken to the user while the block is running. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the input schema for the block. This is the input the block needs to run. It's given to the block as steps[0].input + *

These are accessible as variables:

+ *
    + *
  • ({{input.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.input.propertyName}}) in context of the workflow
  • + *
+ */ + @JsonProperty("inputSchema") + public Optional getInputSchema() { + return inputSchema; + } + + /** + * @return This is the output schema for the block. This is the output the block will return to the workflow ({{stepName.output}}). + *

These are accessible as variables:

+ *
    + *
  • ({{output.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
  • + *
  • ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2)
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ */ + @JsonProperty("outputSchema") + public Optional getOutputSchema() { + return outputSchema; + } + + /** + * @return This is the unique identifier for the block. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the organization that this block belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the block was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the block was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the name of the block. This is just for your reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the instruction to the model. + *

You can reference any variable in the context of the current block execution (step):

+ *
    + *
  • "{{input.your-property-name}}" for the current step's input
  • + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • + *
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

This can be as simple or as complex as you want it to be.

+ *
    + *
  • "say hello and ask the user about their day!"
  • + *
  • "collect the user's first and last name"
  • + *
  • "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}. ask them about their salary and if they might be interested in buying a house. we offer {{input.offer}}"
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output/input.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output/input.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ */ + @JsonProperty("instruction") + public String getInstruction() { + return instruction; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConversationBlock && equalTo((ConversationBlock) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConversationBlock other) { + return messages.equals(other.messages) + && inputSchema.equals(other.inputSchema) + && outputSchema.equals(other.outputSchema) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && name.equals(other.name) + && instruction.equals(other.instruction); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.messages, + this.inputSchema, + this.outputSchema, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.name, + this.instruction); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(ConversationBlock other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + InstructionStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface InstructionStage { + _FinalStage instruction(@NotNull String instruction); + } + + public interface _FinalStage { + ConversationBlock build(); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage inputSchema(Optional inputSchema); + + _FinalStage inputSchema(JsonSchema inputSchema); + + _FinalStage outputSchema(Optional outputSchema); + + _FinalStage outputSchema(JsonSchema outputSchema); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, InstructionStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private String instruction; + + private Optional name = Optional.empty(); + + private Optional outputSchema = Optional.empty(); + + private Optional inputSchema = Optional.empty(); + + private Optional> messages = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConversationBlock other) { + messages(other.getMessages()); + inputSchema(other.getInputSchema()); + outputSchema(other.getOutputSchema()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + name(other.getName()); + instruction(other.getInstruction()); + return this; + } + + /** + *

This is the unique identifier for the block.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the organization that this block belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the block was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the block was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public InstructionStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the instruction to the model.

+ *

You can reference any variable in the context of the current block execution (step):

+ *
    + *
  • "{{input.your-property-name}}" for the current step's input
  • + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • + *
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

This can be as simple or as complex as you want it to be.

+ *
    + *
  • "say hello and ask the user about their day!"
  • + *
  • "collect the user's first and last name"
  • + *
  • "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}. ask them about their salary and if they might be interested in buying a house. we offer {{input.offer}}"
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output/input.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output/input.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("instruction") + public _FinalStage instruction(@NotNull String instruction) { + this.instruction = Objects.requireNonNull(instruction, "instruction must not be null"); + return this; + } + + /** + *

This is the name of the block. This is just for your reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the output schema for the block. This is the output the block will return to the workflow ({{stepName.output}}).

+ *

These are accessible as variables:

+ *
    + *
  • ({{output.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
  • + *
  • ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2)
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage outputSchema(JsonSchema outputSchema) { + this.outputSchema = Optional.ofNullable(outputSchema); + return this; + } + + @java.lang.Override + @JsonSetter(value = "outputSchema", nulls = Nulls.SKIP) + public _FinalStage outputSchema(Optional outputSchema) { + this.outputSchema = outputSchema; + return this; + } + + /** + *

This is the input schema for the block. This is the input the block needs to run. It's given to the block as steps[0].input

+ *

These are accessible as variables:

+ *
    + *
  • ({{input.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.input.propertyName}}) in context of the workflow
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage inputSchema(JsonSchema inputSchema) { + this.inputSchema = Optional.ofNullable(inputSchema); + return this; + } + + @java.lang.Override + @JsonSetter(value = "inputSchema", nulls = Nulls.SKIP) + public _FinalStage inputSchema(Optional inputSchema) { + this.inputSchema = inputSchema; + return this; + } + + /** + *

These are the pre-configured messages that will be spoken to the user while the block is running.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + @java.lang.Override + public ConversationBlock build() { + return new ConversationBlock( + messages, + inputSchema, + outputSchema, + id, + orgId, + createdAt, + updatedAt, + name, + instruction, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ConversationBlockMessagesItem.java b/src/main/java/com/vapi/api/types/ConversationBlockMessagesItem.java new file mode 100644 index 0000000..8544e08 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ConversationBlockMessagesItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ConversationBlockMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ConversationBlockMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ConversationBlockMessagesItem blockStart(BlockStartMessage value) { + return new ConversationBlockMessagesItem(new BlockStartValue(value)); + } + + public static ConversationBlockMessagesItem blockComplete(BlockCompleteMessage value) { + return new ConversationBlockMessagesItem(new BlockCompleteValue(value)); + } + + public boolean isBlockStart() { + return value instanceof BlockStartValue; + } + + public boolean isBlockComplete() { + return value instanceof BlockCompleteValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getBlockStart() { + if (isBlockStart()) { + return Optional.of(((BlockStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getBlockComplete() { + if (isBlockComplete()) { + return Optional.of(((BlockCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitBlockStart(BlockStartMessage blockStart); + + T visitBlockComplete(BlockCompleteMessage blockComplete); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(BlockStartValue.class), @JsonSubTypes.Type(BlockCompleteValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("block-start") + private static final class BlockStartValue implements Value { + @JsonUnwrapped + private BlockStartMessage value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BlockStartValue() {} + + private BlockStartValue(BlockStartMessage value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBlockStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockStartValue && equalTo((BlockStartValue) other); + } + + private boolean equalTo(BlockStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConversationBlockMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("block-complete") + private static final class BlockCompleteValue implements Value { + @JsonUnwrapped + private BlockCompleteMessage value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BlockCompleteValue() {} + + private BlockCompleteValue(BlockCompleteMessage value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBlockComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockCompleteValue && equalTo((BlockCompleteValue) other); + } + + private boolean equalTo(BlockCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ConversationBlockMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ConversationBlockMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CostBreakdown.java b/src/main/java/com/vapi/api/types/CostBreakdown.java new file mode 100644 index 0000000..dbb8033 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CostBreakdown.java @@ -0,0 +1,364 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CostBreakdown.Builder.class) +public final class CostBreakdown { + private final Optional transport; + + private final Optional stt; + + private final Optional llm; + + private final Optional tts; + + private final Optional vapi; + + private final Optional total; + + private final Optional llmPromptTokens; + + private final Optional llmCompletionTokens; + + private final Optional ttsCharacters; + + private final Optional analysisCostBreakdown; + + private final Map additionalProperties; + + private CostBreakdown( + Optional transport, + Optional stt, + Optional llm, + Optional tts, + Optional vapi, + Optional total, + Optional llmPromptTokens, + Optional llmCompletionTokens, + Optional ttsCharacters, + Optional analysisCostBreakdown, + Map additionalProperties) { + this.transport = transport; + this.stt = stt; + this.llm = llm; + this.tts = tts; + this.vapi = vapi; + this.total = total; + this.llmPromptTokens = llmPromptTokens; + this.llmCompletionTokens = llmCompletionTokens; + this.ttsCharacters = ttsCharacters; + this.analysisCostBreakdown = analysisCostBreakdown; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the cost of the transport provider, like Twilio or Vonage. + */ + @JsonProperty("transport") + public Optional getTransport() { + return transport; + } + + /** + * @return This is the cost of the speech-to-text service. + */ + @JsonProperty("stt") + public Optional getStt() { + return stt; + } + + /** + * @return This is the cost of the language model. + */ + @JsonProperty("llm") + public Optional getLlm() { + return llm; + } + + /** + * @return This is the cost of the text-to-speech service. + */ + @JsonProperty("tts") + public Optional getTts() { + return tts; + } + + /** + * @return This is the cost of Vapi. + */ + @JsonProperty("vapi") + public Optional getVapi() { + return vapi; + } + + /** + * @return This is the total cost of the call. + */ + @JsonProperty("total") + public Optional getTotal() { + return total; + } + + /** + * @return This is the LLM prompt tokens used for the call. + */ + @JsonProperty("llmPromptTokens") + public Optional getLlmPromptTokens() { + return llmPromptTokens; + } + + /** + * @return This is the LLM completion tokens used for the call. + */ + @JsonProperty("llmCompletionTokens") + public Optional getLlmCompletionTokens() { + return llmCompletionTokens; + } + + /** + * @return This is the TTS characters used for the call. + */ + @JsonProperty("ttsCharacters") + public Optional getTtsCharacters() { + return ttsCharacters; + } + + /** + * @return This is the cost of the analysis. + */ + @JsonProperty("analysisCostBreakdown") + public Optional getAnalysisCostBreakdown() { + return analysisCostBreakdown; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CostBreakdown && equalTo((CostBreakdown) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CostBreakdown other) { + return transport.equals(other.transport) + && stt.equals(other.stt) + && llm.equals(other.llm) + && tts.equals(other.tts) + && vapi.equals(other.vapi) + && total.equals(other.total) + && llmPromptTokens.equals(other.llmPromptTokens) + && llmCompletionTokens.equals(other.llmCompletionTokens) + && ttsCharacters.equals(other.ttsCharacters) + && analysisCostBreakdown.equals(other.analysisCostBreakdown); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.transport, + this.stt, + this.llm, + this.tts, + this.vapi, + this.total, + this.llmPromptTokens, + this.llmCompletionTokens, + this.ttsCharacters, + this.analysisCostBreakdown); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional transport = Optional.empty(); + + private Optional stt = Optional.empty(); + + private Optional llm = Optional.empty(); + + private Optional tts = Optional.empty(); + + private Optional vapi = Optional.empty(); + + private Optional total = Optional.empty(); + + private Optional llmPromptTokens = Optional.empty(); + + private Optional llmCompletionTokens = Optional.empty(); + + private Optional ttsCharacters = Optional.empty(); + + private Optional analysisCostBreakdown = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CostBreakdown other) { + transport(other.getTransport()); + stt(other.getStt()); + llm(other.getLlm()); + tts(other.getTts()); + vapi(other.getVapi()); + total(other.getTotal()); + llmPromptTokens(other.getLlmPromptTokens()); + llmCompletionTokens(other.getLlmCompletionTokens()); + ttsCharacters(other.getTtsCharacters()); + analysisCostBreakdown(other.getAnalysisCostBreakdown()); + return this; + } + + @JsonSetter(value = "transport", nulls = Nulls.SKIP) + public Builder transport(Optional transport) { + this.transport = transport; + return this; + } + + public Builder transport(Double transport) { + this.transport = Optional.ofNullable(transport); + return this; + } + + @JsonSetter(value = "stt", nulls = Nulls.SKIP) + public Builder stt(Optional stt) { + this.stt = stt; + return this; + } + + public Builder stt(Double stt) { + this.stt = Optional.ofNullable(stt); + return this; + } + + @JsonSetter(value = "llm", nulls = Nulls.SKIP) + public Builder llm(Optional llm) { + this.llm = llm; + return this; + } + + public Builder llm(Double llm) { + this.llm = Optional.ofNullable(llm); + return this; + } + + @JsonSetter(value = "tts", nulls = Nulls.SKIP) + public Builder tts(Optional tts) { + this.tts = tts; + return this; + } + + public Builder tts(Double tts) { + this.tts = Optional.ofNullable(tts); + return this; + } + + @JsonSetter(value = "vapi", nulls = Nulls.SKIP) + public Builder vapi(Optional vapi) { + this.vapi = vapi; + return this; + } + + public Builder vapi(Double vapi) { + this.vapi = Optional.ofNullable(vapi); + return this; + } + + @JsonSetter(value = "total", nulls = Nulls.SKIP) + public Builder total(Optional total) { + this.total = total; + return this; + } + + public Builder total(Double total) { + this.total = Optional.ofNullable(total); + return this; + } + + @JsonSetter(value = "llmPromptTokens", nulls = Nulls.SKIP) + public Builder llmPromptTokens(Optional llmPromptTokens) { + this.llmPromptTokens = llmPromptTokens; + return this; + } + + public Builder llmPromptTokens(Double llmPromptTokens) { + this.llmPromptTokens = Optional.ofNullable(llmPromptTokens); + return this; + } + + @JsonSetter(value = "llmCompletionTokens", nulls = Nulls.SKIP) + public Builder llmCompletionTokens(Optional llmCompletionTokens) { + this.llmCompletionTokens = llmCompletionTokens; + return this; + } + + public Builder llmCompletionTokens(Double llmCompletionTokens) { + this.llmCompletionTokens = Optional.ofNullable(llmCompletionTokens); + return this; + } + + @JsonSetter(value = "ttsCharacters", nulls = Nulls.SKIP) + public Builder ttsCharacters(Optional ttsCharacters) { + this.ttsCharacters = ttsCharacters; + return this; + } + + public Builder ttsCharacters(Double ttsCharacters) { + this.ttsCharacters = Optional.ofNullable(ttsCharacters); + return this; + } + + @JsonSetter(value = "analysisCostBreakdown", nulls = Nulls.SKIP) + public Builder analysisCostBreakdown(Optional analysisCostBreakdown) { + this.analysisCostBreakdown = analysisCostBreakdown; + return this; + } + + public Builder analysisCostBreakdown(AnalysisCostBreakdown analysisCostBreakdown) { + this.analysisCostBreakdown = Optional.ofNullable(analysisCostBreakdown); + return this; + } + + public CostBreakdown build() { + return new CostBreakdown( + transport, + stt, + llm, + tts, + vapi, + total, + llmPromptTokens, + llmCompletionTokens, + ttsCharacters, + analysisCostBreakdown, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateAnthropicCredentialDto.java b/src/main/java/com/vapi/api/types/CreateAnthropicCredentialDto.java new file mode 100644 index 0000000..5b35cd2 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateAnthropicCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAnthropicCredentialDto.Builder.class) +public final class CreateAnthropicCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreateAnthropicCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "anthropic"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAnthropicCredentialDto && equalTo((CreateAnthropicCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAnthropicCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateAnthropicCredentialDto other); + } + + public interface _FinalStage { + CreateAnthropicCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAnthropicCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateAnthropicCredentialDto build() { + return new CreateAnthropicCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateAnyscaleCredentialDto.java b/src/main/java/com/vapi/api/types/CreateAnyscaleCredentialDto.java new file mode 100644 index 0000000..57d763c --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateAnyscaleCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAnyscaleCredentialDto.Builder.class) +public final class CreateAnyscaleCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreateAnyscaleCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "anyscale"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAnyscaleCredentialDto && equalTo((CreateAnyscaleCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAnyscaleCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateAnyscaleCredentialDto other); + } + + public interface _FinalStage { + CreateAnyscaleCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAnyscaleCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateAnyscaleCredentialDto build() { + return new CreateAnyscaleCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateAssistantDto.java b/src/main/java/com/vapi/api/types/CreateAssistantDto.java new file mode 100644 index 0000000..8d05243 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateAssistantDto.java @@ -0,0 +1,991 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAssistantDto.Builder.class) +public final class CreateAssistantDto { + private final Optional transcriber; + + private final Optional model; + + private final Optional voice; + + private final Optional firstMessageMode; + + private final Optional hipaaEnabled; + + private final Optional> clientMessages; + + private final Optional> serverMessages; + + private final Optional silenceTimeoutSeconds; + + private final Optional maxDurationSeconds; + + private final Optional backgroundSound; + + private final Optional backchannelingEnabled; + + private final Optional backgroundDenoisingEnabled; + + private final Optional modelOutputInMessagesEnabled; + + private final Optional> transportConfigurations; + + private final Optional name; + + private final Optional firstMessage; + + private final Optional voicemailDetection; + + private final Optional voicemailMessage; + + private final Optional endCallMessage; + + private final Optional> endCallPhrases; + + private final Optional> metadata; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Optional analysisPlan; + + private final Optional artifactPlan; + + private final Optional messagePlan; + + private final Optional startSpeakingPlan; + + private final Optional stopSpeakingPlan; + + private final Optional monitorPlan; + + private final Optional> credentialIds; + + private final Map additionalProperties; + + private CreateAssistantDto( + Optional transcriber, + Optional model, + Optional voice, + Optional firstMessageMode, + Optional hipaaEnabled, + Optional> clientMessages, + Optional> serverMessages, + Optional silenceTimeoutSeconds, + Optional maxDurationSeconds, + Optional backgroundSound, + Optional backchannelingEnabled, + Optional backgroundDenoisingEnabled, + Optional modelOutputInMessagesEnabled, + Optional> transportConfigurations, + Optional name, + Optional firstMessage, + Optional voicemailDetection, + Optional voicemailMessage, + Optional endCallMessage, + Optional> endCallPhrases, + Optional> metadata, + Optional serverUrl, + Optional serverUrlSecret, + Optional analysisPlan, + Optional artifactPlan, + Optional messagePlan, + Optional startSpeakingPlan, + Optional stopSpeakingPlan, + Optional monitorPlan, + Optional> credentialIds, + Map additionalProperties) { + this.transcriber = transcriber; + this.model = model; + this.voice = voice; + this.firstMessageMode = firstMessageMode; + this.hipaaEnabled = hipaaEnabled; + this.clientMessages = clientMessages; + this.serverMessages = serverMessages; + this.silenceTimeoutSeconds = silenceTimeoutSeconds; + this.maxDurationSeconds = maxDurationSeconds; + this.backgroundSound = backgroundSound; + this.backchannelingEnabled = backchannelingEnabled; + this.backgroundDenoisingEnabled = backgroundDenoisingEnabled; + this.modelOutputInMessagesEnabled = modelOutputInMessagesEnabled; + this.transportConfigurations = transportConfigurations; + this.name = name; + this.firstMessage = firstMessage; + this.voicemailDetection = voicemailDetection; + this.voicemailMessage = voicemailMessage; + this.endCallMessage = endCallMessage; + this.endCallPhrases = endCallPhrases; + this.metadata = metadata; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.analysisPlan = analysisPlan; + this.artifactPlan = artifactPlan; + this.messagePlan = messagePlan; + this.startSpeakingPlan = startSpeakingPlan; + this.stopSpeakingPlan = stopSpeakingPlan; + this.monitorPlan = monitorPlan; + this.credentialIds = credentialIds; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the options for the assistant's transcriber. + */ + @JsonProperty("transcriber") + public Optional getTranscriber() { + return transcriber; + } + + /** + * @return These are the options for the assistant's LLM. + */ + @JsonProperty("model") + public Optional getModel() { + return model; + } + + /** + * @return These are the options for the assistant's voice. + */ + @JsonProperty("voice") + public Optional getVoice() { + return voice; + } + + /** + * @return This is the mode for the first message. Default is 'assistant-speaks-first'. + *

Use:

+ *
    + *
  • 'assistant-speaks-first' to have the assistant speak first.
  • + *
  • 'assistant-waits-for-user' to have the assistant wait for the user to speak first.
  • + *
  • 'assistant-speaks-first-with-model-generated-message' to have the assistant speak first with a message generated by the model based on the conversation state. (assistant.model.messages at call start, call.messages at squad transfer points).
  • + *
+ *

@default 'assistant-speaks-first'

+ */ + @JsonProperty("firstMessageMode") + public Optional getFirstMessageMode() { + return firstMessageMode; + } + + /** + * @return When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false. + */ + @JsonProperty("hipaaEnabled") + public Optional getHipaaEnabled() { + return hipaaEnabled; + } + + /** + * @return These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transcript,tool-calls,user-interrupted,voice-input. You can check the shape of the messages in ClientMessage schema. + */ + @JsonProperty("clientMessages") + public Optional> getClientMessages() { + return clientMessages; + } + + /** + * @return These are the messages that will be sent to your Server URL. Default is conversation-update,end-of-call-report,function-call,hang,speech-update,status-update,tool-calls,transfer-destination-request,user-interrupted. You can check the shape of the messages in ServerMessage schema. + */ + @JsonProperty("serverMessages") + public Optional> getServerMessages() { + return serverMessages; + } + + /** + * @return How many seconds of silence to wait before ending the call. Defaults to 30. + *

@default 30

+ */ + @JsonProperty("silenceTimeoutSeconds") + public Optional getSilenceTimeoutSeconds() { + return silenceTimeoutSeconds; + } + + /** + * @return This is the maximum number of seconds that the call will last. When the call reaches this duration, it will be ended. + *

@default 600 (10 minutes)

+ */ + @JsonProperty("maxDurationSeconds") + public Optional getMaxDurationSeconds() { + return maxDurationSeconds; + } + + /** + * @return This is the background sound in the call. Default for phone calls is 'office' and default for web calls is 'off'. + */ + @JsonProperty("backgroundSound") + public Optional getBackgroundSound() { + return backgroundSound; + } + + /** + * @return This determines whether the model says 'mhmm', 'ahem' etc. while user is speaking. + *

Default false while in beta.

+ *

@default false

+ */ + @JsonProperty("backchannelingEnabled") + public Optional getBackchannelingEnabled() { + return backchannelingEnabled; + } + + /** + * @return This enables filtering of noise and background speech while the user is talking. + *

Default false while in beta.

+ *

@default false

+ */ + @JsonProperty("backgroundDenoisingEnabled") + public Optional getBackgroundDenoisingEnabled() { + return backgroundDenoisingEnabled; + } + + /** + * @return This determines whether the model's output is used in conversation history rather than the transcription of assistant's speech. + *

Default false while in beta.

+ *

@default false

+ */ + @JsonProperty("modelOutputInMessagesEnabled") + public Optional getModelOutputInMessagesEnabled() { + return modelOutputInMessagesEnabled; + } + + /** + * @return These are the configurations to be passed to the transport providers of assistant's calls, like Twilio. You can store multiple configurations for different transport providers. For a call, only the configuration matching the call transport provider is used. + */ + @JsonProperty("transportConfigurations") + public Optional> getTransportConfigurations() { + return transportConfigurations; + } + + /** + * @return This is the name of the assistant. + *

This is required when you want to transfer between assistants in a call.

+ */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the first message that the assistant will say. This can also be a URL to a containerized audio file (mp3, wav, etc.). + *

If unspecified, assistant will wait for user to speak and use the model to respond once they speak.

+ */ + @JsonProperty("firstMessage") + public Optional getFirstMessage() { + return firstMessage; + } + + /** + * @return These are the settings to configure or disable voicemail detection. Alternatively, voicemail detection can be configured using the model.tools=[VoicemailTool]. + * This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached. + * You can use neither of them, one of them, or both of them. By default, Twilio built-in detection is enabled while VoicemailTool is not. + */ + @JsonProperty("voicemailDetection") + public Optional getVoicemailDetection() { + return voicemailDetection; + } + + /** + * @return This is the message that the assistant will say if the call is forwarded to voicemail. + *

If unspecified, it will hang up.

+ */ + @JsonProperty("voicemailMessage") + public Optional getVoicemailMessage() { + return voicemailMessage; + } + + /** + * @return This is the message that the assistant will say if it ends the call. + *

If unspecified, it will hang up without saying anything.

+ */ + @JsonProperty("endCallMessage") + public Optional getEndCallMessage() { + return endCallMessage; + } + + /** + * @return This list contains phrases that, if spoken by the assistant, will trigger the call to be hung up. Case insensitive. + */ + @JsonProperty("endCallPhrases") + public Optional> getEndCallPhrases() { + return endCallPhrases; + } + + /** + * @return This is for metadata you want to store on the assistant. + */ + @JsonProperty("metadata") + public Optional> getMetadata() { + return metadata; + } + + /** + * @return This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports. + *

All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + /** + * @return This is the plan for analysis of assistant's calls. Stored in call.analysis. + */ + @JsonProperty("analysisPlan") + public Optional getAnalysisPlan() { + return analysisPlan; + } + + /** + * @return This is the plan for artifacts generated during assistant's calls. Stored in call.artifact. + *

Note: recordingEnabled is currently at the root level. It will be moved to artifactPlan in the future, but will remain backwards compatible.

+ */ + @JsonProperty("artifactPlan") + public Optional getArtifactPlan() { + return artifactPlan; + } + + /** + * @return This is the plan for static predefined messages that can be spoken by the assistant during the call, like idleMessages. + *

Note: firstMessage, voicemailMessage, and endCallMessage are currently at the root level. They will be moved to messagePlan in the future, but will remain backwards compatible.

+ */ + @JsonProperty("messagePlan") + public Optional getMessagePlan() { + return messagePlan; + } + + /** + * @return This is the plan for when the assistant should start talking. + *

You should configure this if you're running into these issues:

+ *
    + *
  • The assistant is too slow to start talking after the customer is done speaking.
  • + *
  • The assistant is too fast to start talking after the customer is done speaking.
  • + *
  • The assistant is so fast that it's actually interrupting the customer.
  • + *
+ */ + @JsonProperty("startSpeakingPlan") + public Optional getStartSpeakingPlan() { + return startSpeakingPlan; + } + + /** + * @return This is the plan for when assistant should stop talking on customer interruption. + *

You should configure this if you're running into these issues:

+ *
    + *
  • The assistant is too slow to recognize customer's interruption.
  • + *
  • The assistant is too fast to recognize customer's interruption.
  • + *
  • The assistant is getting interrupted by phrases that are just acknowledgments.
  • + *
  • The assistant is getting interrupted by background noises.
  • + *
  • The assistant is not properly stopping -- it starts talking right after getting interrupted.
  • + *
+ */ + @JsonProperty("stopSpeakingPlan") + public Optional getStopSpeakingPlan() { + return stopSpeakingPlan; + } + + /** + * @return This is the plan for real-time monitoring of the assistant's calls. + *

Usage:

+ *
    + *
  • To enable live listening of the assistant's calls, set monitorPlan.listenEnabled to true.
  • + *
  • To enable live control of the assistant's calls, set monitorPlan.controlEnabled to true.
  • + *
+ *

Note, serverMessages, clientMessages, serverUrl and serverUrlSecret are currently at the root level but will be moved to monitorPlan in the future. Will remain backwards compatible

+ */ + @JsonProperty("monitorPlan") + public Optional getMonitorPlan() { + return monitorPlan; + } + + /** + * @return These are the credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can provide a subset using this. + */ + @JsonProperty("credentialIds") + public Optional> getCredentialIds() { + return credentialIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAssistantDto && equalTo((CreateAssistantDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAssistantDto other) { + return transcriber.equals(other.transcriber) + && model.equals(other.model) + && voice.equals(other.voice) + && firstMessageMode.equals(other.firstMessageMode) + && hipaaEnabled.equals(other.hipaaEnabled) + && clientMessages.equals(other.clientMessages) + && serverMessages.equals(other.serverMessages) + && silenceTimeoutSeconds.equals(other.silenceTimeoutSeconds) + && maxDurationSeconds.equals(other.maxDurationSeconds) + && backgroundSound.equals(other.backgroundSound) + && backchannelingEnabled.equals(other.backchannelingEnabled) + && backgroundDenoisingEnabled.equals(other.backgroundDenoisingEnabled) + && modelOutputInMessagesEnabled.equals(other.modelOutputInMessagesEnabled) + && transportConfigurations.equals(other.transportConfigurations) + && name.equals(other.name) + && firstMessage.equals(other.firstMessage) + && voicemailDetection.equals(other.voicemailDetection) + && voicemailMessage.equals(other.voicemailMessage) + && endCallMessage.equals(other.endCallMessage) + && endCallPhrases.equals(other.endCallPhrases) + && metadata.equals(other.metadata) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret) + && analysisPlan.equals(other.analysisPlan) + && artifactPlan.equals(other.artifactPlan) + && messagePlan.equals(other.messagePlan) + && startSpeakingPlan.equals(other.startSpeakingPlan) + && stopSpeakingPlan.equals(other.stopSpeakingPlan) + && monitorPlan.equals(other.monitorPlan) + && credentialIds.equals(other.credentialIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.transcriber, + this.model, + this.voice, + this.firstMessageMode, + this.hipaaEnabled, + this.clientMessages, + this.serverMessages, + this.silenceTimeoutSeconds, + this.maxDurationSeconds, + this.backgroundSound, + this.backchannelingEnabled, + this.backgroundDenoisingEnabled, + this.modelOutputInMessagesEnabled, + this.transportConfigurations, + this.name, + this.firstMessage, + this.voicemailDetection, + this.voicemailMessage, + this.endCallMessage, + this.endCallPhrases, + this.metadata, + this.serverUrl, + this.serverUrlSecret, + this.analysisPlan, + this.artifactPlan, + this.messagePlan, + this.startSpeakingPlan, + this.stopSpeakingPlan, + this.monitorPlan, + this.credentialIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional transcriber = Optional.empty(); + + private Optional model = Optional.empty(); + + private Optional voice = Optional.empty(); + + private Optional firstMessageMode = Optional.empty(); + + private Optional hipaaEnabled = Optional.empty(); + + private Optional> clientMessages = Optional.empty(); + + private Optional> serverMessages = Optional.empty(); + + private Optional silenceTimeoutSeconds = Optional.empty(); + + private Optional maxDurationSeconds = Optional.empty(); + + private Optional backgroundSound = Optional.empty(); + + private Optional backchannelingEnabled = Optional.empty(); + + private Optional backgroundDenoisingEnabled = Optional.empty(); + + private Optional modelOutputInMessagesEnabled = Optional.empty(); + + private Optional> transportConfigurations = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional firstMessage = Optional.empty(); + + private Optional voicemailDetection = Optional.empty(); + + private Optional voicemailMessage = Optional.empty(); + + private Optional endCallMessage = Optional.empty(); + + private Optional> endCallPhrases = Optional.empty(); + + private Optional> metadata = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional serverUrlSecret = Optional.empty(); + + private Optional analysisPlan = Optional.empty(); + + private Optional artifactPlan = Optional.empty(); + + private Optional messagePlan = Optional.empty(); + + private Optional startSpeakingPlan = Optional.empty(); + + private Optional stopSpeakingPlan = Optional.empty(); + + private Optional monitorPlan = Optional.empty(); + + private Optional> credentialIds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateAssistantDto other) { + transcriber(other.getTranscriber()); + model(other.getModel()); + voice(other.getVoice()); + firstMessageMode(other.getFirstMessageMode()); + hipaaEnabled(other.getHipaaEnabled()); + clientMessages(other.getClientMessages()); + serverMessages(other.getServerMessages()); + silenceTimeoutSeconds(other.getSilenceTimeoutSeconds()); + maxDurationSeconds(other.getMaxDurationSeconds()); + backgroundSound(other.getBackgroundSound()); + backchannelingEnabled(other.getBackchannelingEnabled()); + backgroundDenoisingEnabled(other.getBackgroundDenoisingEnabled()); + modelOutputInMessagesEnabled(other.getModelOutputInMessagesEnabled()); + transportConfigurations(other.getTransportConfigurations()); + name(other.getName()); + firstMessage(other.getFirstMessage()); + voicemailDetection(other.getVoicemailDetection()); + voicemailMessage(other.getVoicemailMessage()); + endCallMessage(other.getEndCallMessage()); + endCallPhrases(other.getEndCallPhrases()); + metadata(other.getMetadata()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + analysisPlan(other.getAnalysisPlan()); + artifactPlan(other.getArtifactPlan()); + messagePlan(other.getMessagePlan()); + startSpeakingPlan(other.getStartSpeakingPlan()); + stopSpeakingPlan(other.getStopSpeakingPlan()); + monitorPlan(other.getMonitorPlan()); + credentialIds(other.getCredentialIds()); + return this; + } + + @JsonSetter(value = "transcriber", nulls = Nulls.SKIP) + public Builder transcriber(Optional transcriber) { + this.transcriber = transcriber; + return this; + } + + public Builder transcriber(CreateAssistantDtoTranscriber transcriber) { + this.transcriber = Optional.ofNullable(transcriber); + return this; + } + + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public Builder model(Optional model) { + this.model = model; + return this; + } + + public Builder model(CreateAssistantDtoModel model) { + this.model = Optional.ofNullable(model); + return this; + } + + @JsonSetter(value = "voice", nulls = Nulls.SKIP) + public Builder voice(Optional voice) { + this.voice = voice; + return this; + } + + public Builder voice(CreateAssistantDtoVoice voice) { + this.voice = Optional.ofNullable(voice); + return this; + } + + @JsonSetter(value = "firstMessageMode", nulls = Nulls.SKIP) + public Builder firstMessageMode(Optional firstMessageMode) { + this.firstMessageMode = firstMessageMode; + return this; + } + + public Builder firstMessageMode(CreateAssistantDtoFirstMessageMode firstMessageMode) { + this.firstMessageMode = Optional.ofNullable(firstMessageMode); + return this; + } + + @JsonSetter(value = "hipaaEnabled", nulls = Nulls.SKIP) + public Builder hipaaEnabled(Optional hipaaEnabled) { + this.hipaaEnabled = hipaaEnabled; + return this; + } + + public Builder hipaaEnabled(Boolean hipaaEnabled) { + this.hipaaEnabled = Optional.ofNullable(hipaaEnabled); + return this; + } + + @JsonSetter(value = "clientMessages", nulls = Nulls.SKIP) + public Builder clientMessages(Optional> clientMessages) { + this.clientMessages = clientMessages; + return this; + } + + public Builder clientMessages(List clientMessages) { + this.clientMessages = Optional.ofNullable(clientMessages); + return this; + } + + @JsonSetter(value = "serverMessages", nulls = Nulls.SKIP) + public Builder serverMessages(Optional> serverMessages) { + this.serverMessages = serverMessages; + return this; + } + + public Builder serverMessages(List serverMessages) { + this.serverMessages = Optional.ofNullable(serverMessages); + return this; + } + + @JsonSetter(value = "silenceTimeoutSeconds", nulls = Nulls.SKIP) + public Builder silenceTimeoutSeconds(Optional silenceTimeoutSeconds) { + this.silenceTimeoutSeconds = silenceTimeoutSeconds; + return this; + } + + public Builder silenceTimeoutSeconds(Double silenceTimeoutSeconds) { + this.silenceTimeoutSeconds = Optional.ofNullable(silenceTimeoutSeconds); + return this; + } + + @JsonSetter(value = "maxDurationSeconds", nulls = Nulls.SKIP) + public Builder maxDurationSeconds(Optional maxDurationSeconds) { + this.maxDurationSeconds = maxDurationSeconds; + return this; + } + + public Builder maxDurationSeconds(Double maxDurationSeconds) { + this.maxDurationSeconds = Optional.ofNullable(maxDurationSeconds); + return this; + } + + @JsonSetter(value = "backgroundSound", nulls = Nulls.SKIP) + public Builder backgroundSound(Optional backgroundSound) { + this.backgroundSound = backgroundSound; + return this; + } + + public Builder backgroundSound(CreateAssistantDtoBackgroundSound backgroundSound) { + this.backgroundSound = Optional.ofNullable(backgroundSound); + return this; + } + + @JsonSetter(value = "backchannelingEnabled", nulls = Nulls.SKIP) + public Builder backchannelingEnabled(Optional backchannelingEnabled) { + this.backchannelingEnabled = backchannelingEnabled; + return this; + } + + public Builder backchannelingEnabled(Boolean backchannelingEnabled) { + this.backchannelingEnabled = Optional.ofNullable(backchannelingEnabled); + return this; + } + + @JsonSetter(value = "backgroundDenoisingEnabled", nulls = Nulls.SKIP) + public Builder backgroundDenoisingEnabled(Optional backgroundDenoisingEnabled) { + this.backgroundDenoisingEnabled = backgroundDenoisingEnabled; + return this; + } + + public Builder backgroundDenoisingEnabled(Boolean backgroundDenoisingEnabled) { + this.backgroundDenoisingEnabled = Optional.ofNullable(backgroundDenoisingEnabled); + return this; + } + + @JsonSetter(value = "modelOutputInMessagesEnabled", nulls = Nulls.SKIP) + public Builder modelOutputInMessagesEnabled(Optional modelOutputInMessagesEnabled) { + this.modelOutputInMessagesEnabled = modelOutputInMessagesEnabled; + return this; + } + + public Builder modelOutputInMessagesEnabled(Boolean modelOutputInMessagesEnabled) { + this.modelOutputInMessagesEnabled = Optional.ofNullable(modelOutputInMessagesEnabled); + return this; + } + + @JsonSetter(value = "transportConfigurations", nulls = Nulls.SKIP) + public Builder transportConfigurations(Optional> transportConfigurations) { + this.transportConfigurations = transportConfigurations; + return this; + } + + public Builder transportConfigurations(List transportConfigurations) { + this.transportConfigurations = Optional.ofNullable(transportConfigurations); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "firstMessage", nulls = Nulls.SKIP) + public Builder firstMessage(Optional firstMessage) { + this.firstMessage = firstMessage; + return this; + } + + public Builder firstMessage(String firstMessage) { + this.firstMessage = Optional.ofNullable(firstMessage); + return this; + } + + @JsonSetter(value = "voicemailDetection", nulls = Nulls.SKIP) + public Builder voicemailDetection(Optional voicemailDetection) { + this.voicemailDetection = voicemailDetection; + return this; + } + + public Builder voicemailDetection(TwilioVoicemailDetection voicemailDetection) { + this.voicemailDetection = Optional.ofNullable(voicemailDetection); + return this; + } + + @JsonSetter(value = "voicemailMessage", nulls = Nulls.SKIP) + public Builder voicemailMessage(Optional voicemailMessage) { + this.voicemailMessage = voicemailMessage; + return this; + } + + public Builder voicemailMessage(String voicemailMessage) { + this.voicemailMessage = Optional.ofNullable(voicemailMessage); + return this; + } + + @JsonSetter(value = "endCallMessage", nulls = Nulls.SKIP) + public Builder endCallMessage(Optional endCallMessage) { + this.endCallMessage = endCallMessage; + return this; + } + + public Builder endCallMessage(String endCallMessage) { + this.endCallMessage = Optional.ofNullable(endCallMessage); + return this; + } + + @JsonSetter(value = "endCallPhrases", nulls = Nulls.SKIP) + public Builder endCallPhrases(Optional> endCallPhrases) { + this.endCallPhrases = endCallPhrases; + return this; + } + + public Builder endCallPhrases(List endCallPhrases) { + this.endCallPhrases = Optional.ofNullable(endCallPhrases); + return this; + } + + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public Builder serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + public Builder serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public Builder serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + public Builder serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @JsonSetter(value = "analysisPlan", nulls = Nulls.SKIP) + public Builder analysisPlan(Optional analysisPlan) { + this.analysisPlan = analysisPlan; + return this; + } + + public Builder analysisPlan(AnalysisPlan analysisPlan) { + this.analysisPlan = Optional.ofNullable(analysisPlan); + return this; + } + + @JsonSetter(value = "artifactPlan", nulls = Nulls.SKIP) + public Builder artifactPlan(Optional artifactPlan) { + this.artifactPlan = artifactPlan; + return this; + } + + public Builder artifactPlan(ArtifactPlan artifactPlan) { + this.artifactPlan = Optional.ofNullable(artifactPlan); + return this; + } + + @JsonSetter(value = "messagePlan", nulls = Nulls.SKIP) + public Builder messagePlan(Optional messagePlan) { + this.messagePlan = messagePlan; + return this; + } + + public Builder messagePlan(MessagePlan messagePlan) { + this.messagePlan = Optional.ofNullable(messagePlan); + return this; + } + + @JsonSetter(value = "startSpeakingPlan", nulls = Nulls.SKIP) + public Builder startSpeakingPlan(Optional startSpeakingPlan) { + this.startSpeakingPlan = startSpeakingPlan; + return this; + } + + public Builder startSpeakingPlan(StartSpeakingPlan startSpeakingPlan) { + this.startSpeakingPlan = Optional.ofNullable(startSpeakingPlan); + return this; + } + + @JsonSetter(value = "stopSpeakingPlan", nulls = Nulls.SKIP) + public Builder stopSpeakingPlan(Optional stopSpeakingPlan) { + this.stopSpeakingPlan = stopSpeakingPlan; + return this; + } + + public Builder stopSpeakingPlan(StopSpeakingPlan stopSpeakingPlan) { + this.stopSpeakingPlan = Optional.ofNullable(stopSpeakingPlan); + return this; + } + + @JsonSetter(value = "monitorPlan", nulls = Nulls.SKIP) + public Builder monitorPlan(Optional monitorPlan) { + this.monitorPlan = monitorPlan; + return this; + } + + public Builder monitorPlan(MonitorPlan monitorPlan) { + this.monitorPlan = Optional.ofNullable(monitorPlan); + return this; + } + + @JsonSetter(value = "credentialIds", nulls = Nulls.SKIP) + public Builder credentialIds(Optional> credentialIds) { + this.credentialIds = credentialIds; + return this; + } + + public Builder credentialIds(List credentialIds) { + this.credentialIds = Optional.ofNullable(credentialIds); + return this; + } + + public CreateAssistantDto build() { + return new CreateAssistantDto( + transcriber, + model, + voice, + firstMessageMode, + hipaaEnabled, + clientMessages, + serverMessages, + silenceTimeoutSeconds, + maxDurationSeconds, + backgroundSound, + backchannelingEnabled, + backgroundDenoisingEnabled, + modelOutputInMessagesEnabled, + transportConfigurations, + name, + firstMessage, + voicemailDetection, + voicemailMessage, + endCallMessage, + endCallPhrases, + metadata, + serverUrl, + serverUrlSecret, + analysisPlan, + artifactPlan, + messagePlan, + startSpeakingPlan, + stopSpeakingPlan, + monitorPlan, + credentialIds, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateAssistantDtoBackgroundSound.java b/src/main/java/com/vapi/api/types/CreateAssistantDtoBackgroundSound.java new file mode 100644 index 0000000..2d7b425 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateAssistantDtoBackgroundSound.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CreateAssistantDtoBackgroundSound { + OFF("off"), + + OFFICE("office"); + + private final String value; + + CreateAssistantDtoBackgroundSound(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CreateAssistantDtoClientMessagesItem.java b/src/main/java/com/vapi/api/types/CreateAssistantDtoClientMessagesItem.java new file mode 100644 index 0000000..134da7a --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateAssistantDtoClientMessagesItem.java @@ -0,0 +1,48 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CreateAssistantDtoClientMessagesItem { + CONVERSATION_UPDATE("conversation-update"), + + FUNCTION_CALL("function-call"), + + FUNCTION_CALL_RESULT("function-call-result"), + + HANG("hang"), + + LANGUAGE_CHANGED("language-changed"), + + METADATA("metadata"), + + MODEL_OUTPUT("model-output"), + + SPEECH_UPDATE("speech-update"), + + STATUS_UPDATE("status-update"), + + TRANSCRIPT("transcript"), + + TOOL_CALLS("tool-calls"), + + TOOL_CALLS_RESULT("tool-calls-result"), + + USER_INTERRUPTED("user-interrupted"), + + VOICE_INPUT("voice-input"); + + private final String value; + + CreateAssistantDtoClientMessagesItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CreateAssistantDtoFirstMessageMode.java b/src/main/java/com/vapi/api/types/CreateAssistantDtoFirstMessageMode.java new file mode 100644 index 0000000..e05f857 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateAssistantDtoFirstMessageMode.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CreateAssistantDtoFirstMessageMode { + ASSISTANT_SPEAKS_FIRST("assistant-speaks-first"), + + ASSISTANT_SPEAKS_FIRST_WITH_MODEL_GENERATED_MESSAGE("assistant-speaks-first-with-model-generated-message"), + + ASSISTANT_WAITS_FOR_USER("assistant-waits-for-user"); + + private final String value; + + CreateAssistantDtoFirstMessageMode(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CreateAssistantDtoModel.java b/src/main/java/com/vapi/api/types/CreateAssistantDtoModel.java new file mode 100644 index 0000000..bb64a1e --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateAssistantDtoModel.java @@ -0,0 +1,651 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateAssistantDtoModel { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateAssistantDtoModel(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateAssistantDtoModel anyscale(AnyscaleModel value) { + return new CreateAssistantDtoModel(new AnyscaleValue(value)); + } + + public static CreateAssistantDtoModel anthropic(AnthropicModel value) { + return new CreateAssistantDtoModel(new AnthropicValue(value)); + } + + public static CreateAssistantDtoModel customLlm(CustomLlmModel value) { + return new CreateAssistantDtoModel(new CustomLlmValue(value)); + } + + public static CreateAssistantDtoModel deepinfra(DeepInfraModel value) { + return new CreateAssistantDtoModel(new DeepinfraValue(value)); + } + + public static CreateAssistantDtoModel groq(GroqModel value) { + return new CreateAssistantDtoModel(new GroqValue(value)); + } + + public static CreateAssistantDtoModel openai(OpenAiModel value) { + return new CreateAssistantDtoModel(new OpenaiValue(value)); + } + + public static CreateAssistantDtoModel openrouter(OpenRouterModel value) { + return new CreateAssistantDtoModel(new OpenrouterValue(value)); + } + + public static CreateAssistantDtoModel perplexityAi(PerplexityAiModel value) { + return new CreateAssistantDtoModel(new PerplexityAiValue(value)); + } + + public static CreateAssistantDtoModel togetherAi(TogetherAiModel value) { + return new CreateAssistantDtoModel(new TogetherAiValue(value)); + } + + public static CreateAssistantDtoModel vapi(VapiModel value) { + return new CreateAssistantDtoModel(new VapiValue(value)); + } + + public boolean isAnyscale() { + return value instanceof AnyscaleValue; + } + + public boolean isAnthropic() { + return value instanceof AnthropicValue; + } + + public boolean isCustomLlm() { + return value instanceof CustomLlmValue; + } + + public boolean isDeepinfra() { + return value instanceof DeepinfraValue; + } + + public boolean isGroq() { + return value instanceof GroqValue; + } + + public boolean isOpenai() { + return value instanceof OpenaiValue; + } + + public boolean isOpenrouter() { + return value instanceof OpenrouterValue; + } + + public boolean isPerplexityAi() { + return value instanceof PerplexityAiValue; + } + + public boolean isTogetherAi() { + return value instanceof TogetherAiValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAnyscale() { + if (isAnyscale()) { + return Optional.of(((AnyscaleValue) value).value); + } + return Optional.empty(); + } + + public Optional getAnthropic() { + if (isAnthropic()) { + return Optional.of(((AnthropicValue) value).value); + } + return Optional.empty(); + } + + public Optional getCustomLlm() { + if (isCustomLlm()) { + return Optional.of(((CustomLlmValue) value).value); + } + return Optional.empty(); + } + + public Optional getDeepinfra() { + if (isDeepinfra()) { + return Optional.of(((DeepinfraValue) value).value); + } + return Optional.empty(); + } + + public Optional getGroq() { + if (isGroq()) { + return Optional.of(((GroqValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenai() { + if (isOpenai()) { + return Optional.of(((OpenaiValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenrouter() { + if (isOpenrouter()) { + return Optional.of(((OpenrouterValue) value).value); + } + return Optional.empty(); + } + + public Optional getPerplexityAi() { + if (isPerplexityAi()) { + return Optional.of(((PerplexityAiValue) value).value); + } + return Optional.empty(); + } + + public Optional getTogetherAi() { + if (isTogetherAi()) { + return Optional.of(((TogetherAiValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAnyscale(AnyscaleModel anyscale); + + T visitAnthropic(AnthropicModel anthropic); + + T visitCustomLlm(CustomLlmModel customLlm); + + T visitDeepinfra(DeepInfraModel deepinfra); + + T visitGroq(GroqModel groq); + + T visitOpenai(OpenAiModel openai); + + T visitOpenrouter(OpenRouterModel openrouter); + + T visitPerplexityAi(PerplexityAiModel perplexityAi); + + T visitTogetherAi(TogetherAiModel togetherAi); + + T visitVapi(VapiModel vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AnyscaleValue.class), + @JsonSubTypes.Type(AnthropicValue.class), + @JsonSubTypes.Type(CustomLlmValue.class), + @JsonSubTypes.Type(DeepinfraValue.class), + @JsonSubTypes.Type(GroqValue.class), + @JsonSubTypes.Type(OpenaiValue.class), + @JsonSubTypes.Type(OpenrouterValue.class), + @JsonSubTypes.Type(PerplexityAiValue.class), + @JsonSubTypes.Type(TogetherAiValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("anyscale") + private static final class AnyscaleValue implements Value { + @JsonUnwrapped + private AnyscaleModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AnyscaleValue() {} + + private AnyscaleValue(AnyscaleModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAnyscale(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnyscaleValue && equalTo((AnyscaleValue) other); + } + + private boolean equalTo(AnyscaleValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("anthropic") + private static final class AnthropicValue implements Value { + @JsonUnwrapped + private AnthropicModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AnthropicValue() {} + + private AnthropicValue(AnthropicModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAnthropic(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnthropicValue && equalTo((AnthropicValue) other); + } + + private boolean equalTo(AnthropicValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("custom-llm") + private static final class CustomLlmValue implements Value { + @JsonUnwrapped + private CustomLlmModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CustomLlmValue() {} + + private CustomLlmValue(CustomLlmModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCustomLlm(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CustomLlmValue && equalTo((CustomLlmValue) other); + } + + private boolean equalTo(CustomLlmValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("deepinfra") + private static final class DeepinfraValue implements Value { + @JsonUnwrapped + private DeepInfraModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepinfraValue() {} + + private DeepinfraValue(DeepInfraModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDeepinfra(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepinfraValue && equalTo((DeepinfraValue) other); + } + + private boolean equalTo(DeepinfraValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("groq") + private static final class GroqValue implements Value { + @JsonUnwrapped + private GroqModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GroqValue() {} + + private GroqValue(GroqModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGroq(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GroqValue && equalTo((GroqValue) other); + } + + private boolean equalTo(GroqValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("openai") + private static final class OpenaiValue implements Value { + @JsonUnwrapped + private OpenAiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenaiValue() {} + + private OpenaiValue(OpenAiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOpenai(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenaiValue && equalTo((OpenaiValue) other); + } + + private boolean equalTo(OpenaiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("openrouter") + private static final class OpenrouterValue implements Value { + @JsonUnwrapped + private OpenRouterModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenrouterValue() {} + + private OpenrouterValue(OpenRouterModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOpenrouter(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenrouterValue && equalTo((OpenrouterValue) other); + } + + private boolean equalTo(OpenrouterValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("perplexity-ai") + private static final class PerplexityAiValue implements Value { + @JsonUnwrapped + private PerplexityAiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private PerplexityAiValue() {} + + private PerplexityAiValue(PerplexityAiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitPerplexityAi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PerplexityAiValue && equalTo((PerplexityAiValue) other); + } + + private boolean equalTo(PerplexityAiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("together-ai") + private static final class TogetherAiValue implements Value { + @JsonUnwrapped + private TogetherAiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TogetherAiValue() {} + + private TogetherAiValue(TogetherAiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTogetherAi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TogetherAiValue && equalTo((TogetherAiValue) other); + } + + private boolean equalTo(TogetherAiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private VapiModel value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(VapiModel value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoModel{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoModel{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateAssistantDtoServerMessagesItem.java b/src/main/java/com/vapi/api/types/CreateAssistantDtoServerMessagesItem.java new file mode 100644 index 0000000..cf3c83c --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateAssistantDtoServerMessagesItem.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CreateAssistantDtoServerMessagesItem { + CONVERSATION_UPDATE("conversation-update"), + + END_OF_CALL_REPORT("end-of-call-report"), + + FUNCTION_CALL("function-call"), + + HANG("hang"), + + LANGUAGE_CHANGED("language-changed"), + + MODEL_OUTPUT("model-output"), + + PHONE_CALL_CONTROL("phone-call-control"), + + SPEECH_UPDATE("speech-update"), + + STATUS_UPDATE("status-update"), + + TRANSCRIPT("transcript"), + + TOOL_CALLS("tool-calls"), + + TRANSFER_DESTINATION_REQUEST("transfer-destination-request"), + + TRANSFER_UPDATE("transfer-update"), + + USER_INTERRUPTED("user-interrupted"), + + VOICE_INPUT("voice-input"); + + private final String value; + + CreateAssistantDtoServerMessagesItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CreateAssistantDtoTranscriber.java b/src/main/java/com/vapi/api/types/CreateAssistantDtoTranscriber.java new file mode 100644 index 0000000..6d13ac4 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateAssistantDtoTranscriber.java @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateAssistantDtoTranscriber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateAssistantDtoTranscriber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateAssistantDtoTranscriber deepgram(DeepgramTranscriber value) { + return new CreateAssistantDtoTranscriber(new DeepgramValue(value)); + } + + public static CreateAssistantDtoTranscriber gladia(GladiaTranscriber value) { + return new CreateAssistantDtoTranscriber(new GladiaValue(value)); + } + + public static CreateAssistantDtoTranscriber talkscriber(TalkscriberTranscriber value) { + return new CreateAssistantDtoTranscriber(new TalkscriberValue(value)); + } + + public boolean isDeepgram() { + return value instanceof DeepgramValue; + } + + public boolean isGladia() { + return value instanceof GladiaValue; + } + + public boolean isTalkscriber() { + return value instanceof TalkscriberValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDeepgram() { + if (isDeepgram()) { + return Optional.of(((DeepgramValue) value).value); + } + return Optional.empty(); + } + + public Optional getGladia() { + if (isGladia()) { + return Optional.of(((GladiaValue) value).value); + } + return Optional.empty(); + } + + public Optional getTalkscriber() { + if (isTalkscriber()) { + return Optional.of(((TalkscriberValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDeepgram(DeepgramTranscriber deepgram); + + T visitGladia(GladiaTranscriber gladia); + + T visitTalkscriber(TalkscriberTranscriber talkscriber); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DeepgramValue.class), + @JsonSubTypes.Type(GladiaValue.class), + @JsonSubTypes.Type(TalkscriberValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("deepgram") + private static final class DeepgramValue implements Value { + @JsonUnwrapped + private DeepgramTranscriber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepgramValue() {} + + private DeepgramValue(DeepgramTranscriber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDeepgram(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepgramValue && equalTo((DeepgramValue) other); + } + + private boolean equalTo(DeepgramValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoTranscriber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("gladia") + private static final class GladiaValue implements Value { + @JsonUnwrapped + private GladiaTranscriber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GladiaValue() {} + + private GladiaValue(GladiaTranscriber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGladia(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GladiaValue && equalTo((GladiaValue) other); + } + + private boolean equalTo(GladiaValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoTranscriber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("talkscriber") + private static final class TalkscriberValue implements Value { + @JsonUnwrapped + private TalkscriberTranscriber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TalkscriberValue() {} + + private TalkscriberValue(TalkscriberTranscriber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTalkscriber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TalkscriberValue && equalTo((TalkscriberValue) other); + } + + private boolean equalTo(TalkscriberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoTranscriber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoTranscriber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateAssistantDtoVoice.java b/src/main/java/com/vapi/api/types/CreateAssistantDtoVoice.java new file mode 100644 index 0000000..cc75d91 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateAssistantDtoVoice.java @@ -0,0 +1,595 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateAssistantDtoVoice { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateAssistantDtoVoice(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateAssistantDtoVoice azure(AzureVoice value) { + return new CreateAssistantDtoVoice(new AzureValue(value)); + } + + public static CreateAssistantDtoVoice cartesia(CartesiaVoice value) { + return new CreateAssistantDtoVoice(new CartesiaValue(value)); + } + + public static CreateAssistantDtoVoice deepgram(DeepgramVoice value) { + return new CreateAssistantDtoVoice(new DeepgramValue(value)); + } + + public static CreateAssistantDtoVoice _11Labs(ElevenLabsVoice value) { + return new CreateAssistantDtoVoice(new _11LabsValue(value)); + } + + public static CreateAssistantDtoVoice lmnt(LmntVoice value) { + return new CreateAssistantDtoVoice(new LmntValue(value)); + } + + public static CreateAssistantDtoVoice neets(NeetsVoice value) { + return new CreateAssistantDtoVoice(new NeetsValue(value)); + } + + public static CreateAssistantDtoVoice openai(OpenAiVoice value) { + return new CreateAssistantDtoVoice(new OpenaiValue(value)); + } + + public static CreateAssistantDtoVoice playht(PlayHtVoice value) { + return new CreateAssistantDtoVoice(new PlayhtValue(value)); + } + + public static CreateAssistantDtoVoice rimeAi(RimeAiVoice value) { + return new CreateAssistantDtoVoice(new RimeAiValue(value)); + } + + public boolean isAzure() { + return value instanceof AzureValue; + } + + public boolean isCartesia() { + return value instanceof CartesiaValue; + } + + public boolean isDeepgram() { + return value instanceof DeepgramValue; + } + + public boolean is11Labs() { + return value instanceof _11LabsValue; + } + + public boolean isLmnt() { + return value instanceof LmntValue; + } + + public boolean isNeets() { + return value instanceof NeetsValue; + } + + public boolean isOpenai() { + return value instanceof OpenaiValue; + } + + public boolean isPlayht() { + return value instanceof PlayhtValue; + } + + public boolean isRimeAi() { + return value instanceof RimeAiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAzure() { + if (isAzure()) { + return Optional.of(((AzureValue) value).value); + } + return Optional.empty(); + } + + public Optional getCartesia() { + if (isCartesia()) { + return Optional.of(((CartesiaValue) value).value); + } + return Optional.empty(); + } + + public Optional getDeepgram() { + if (isDeepgram()) { + return Optional.of(((DeepgramValue) value).value); + } + return Optional.empty(); + } + + public Optional get11Labs() { + if (is11Labs()) { + return Optional.of(((_11LabsValue) value).value); + } + return Optional.empty(); + } + + public Optional getLmnt() { + if (isLmnt()) { + return Optional.of(((LmntValue) value).value); + } + return Optional.empty(); + } + + public Optional getNeets() { + if (isNeets()) { + return Optional.of(((NeetsValue) value).value); + } + return Optional.empty(); + } + + public Optional getOpenai() { + if (isOpenai()) { + return Optional.of(((OpenaiValue) value).value); + } + return Optional.empty(); + } + + public Optional getPlayht() { + if (isPlayht()) { + return Optional.of(((PlayhtValue) value).value); + } + return Optional.empty(); + } + + public Optional getRimeAi() { + if (isRimeAi()) { + return Optional.of(((RimeAiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAzure(AzureVoice azure); + + T visitCartesia(CartesiaVoice cartesia); + + T visitDeepgram(DeepgramVoice deepgram); + + T visit11Labs(ElevenLabsVoice _11Labs); + + T visitLmnt(LmntVoice lmnt); + + T visitNeets(NeetsVoice neets); + + T visitOpenai(OpenAiVoice openai); + + T visitPlayht(PlayHtVoice playht); + + T visitRimeAi(RimeAiVoice rimeAi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AzureValue.class), + @JsonSubTypes.Type(CartesiaValue.class), + @JsonSubTypes.Type(DeepgramValue.class), + @JsonSubTypes.Type(_11LabsValue.class), + @JsonSubTypes.Type(LmntValue.class), + @JsonSubTypes.Type(NeetsValue.class), + @JsonSubTypes.Type(OpenaiValue.class), + @JsonSubTypes.Type(PlayhtValue.class), + @JsonSubTypes.Type(RimeAiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("azure") + private static final class AzureValue implements Value { + @JsonUnwrapped + private AzureVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AzureValue() {} + + private AzureValue(AzureVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAzure(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AzureValue && equalTo((AzureValue) other); + } + + private boolean equalTo(AzureValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("cartesia") + private static final class CartesiaValue implements Value { + @JsonUnwrapped + private CartesiaVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CartesiaValue() {} + + private CartesiaValue(CartesiaVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCartesia(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CartesiaValue && equalTo((CartesiaValue) other); + } + + private boolean equalTo(CartesiaValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("deepgram") + private static final class DeepgramValue implements Value { + @JsonUnwrapped + private DeepgramVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DeepgramValue() {} + + private DeepgramValue(DeepgramVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDeepgram(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepgramValue && equalTo((DeepgramValue) other); + } + + private boolean equalTo(DeepgramValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("11labs") + private static final class _11LabsValue implements Value { + @JsonUnwrapped + private ElevenLabsVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _11LabsValue() {} + + private _11LabsValue(ElevenLabsVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visit11Labs(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _11LabsValue && equalTo((_11LabsValue) other); + } + + private boolean equalTo(_11LabsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("lmnt") + private static final class LmntValue implements Value { + @JsonUnwrapped + private LmntVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private LmntValue() {} + + private LmntValue(LmntVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitLmnt(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LmntValue && equalTo((LmntValue) other); + } + + private boolean equalTo(LmntValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("neets") + private static final class NeetsValue implements Value { + @JsonUnwrapped + private NeetsVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NeetsValue() {} + + private NeetsValue(NeetsVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNeets(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NeetsValue && equalTo((NeetsValue) other); + } + + private boolean equalTo(NeetsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("openai") + private static final class OpenaiValue implements Value { + @JsonUnwrapped + private OpenAiVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private OpenaiValue() {} + + private OpenaiValue(OpenAiVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitOpenai(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenaiValue && equalTo((OpenaiValue) other); + } + + private boolean equalTo(OpenaiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("playht") + private static final class PlayhtValue implements Value { + @JsonUnwrapped + private PlayHtVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private PlayhtValue() {} + + private PlayhtValue(PlayHtVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitPlayht(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlayhtValue && equalTo((PlayhtValue) other); + } + + private boolean equalTo(PlayhtValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + @JsonTypeName("rime-ai") + private static final class RimeAiValue implements Value { + @JsonUnwrapped + private RimeAiVoice value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RimeAiValue() {} + + private RimeAiValue(RimeAiVoice value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRimeAi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RimeAiValue && equalTo((RimeAiValue) other); + } + + private boolean equalTo(RimeAiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoVoice{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateAssistantDtoVoice{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateAzureOpenAiCredentialDto.java b/src/main/java/com/vapi/api/types/CreateAzureOpenAiCredentialDto.java new file mode 100644 index 0000000..9ecdaa1 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateAzureOpenAiCredentialDto.java @@ -0,0 +1,206 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAzureOpenAiCredentialDto.Builder.class) +public final class CreateAzureOpenAiCredentialDto { + private final CreateAzureOpenAiCredentialDtoRegion region; + + private final List models; + + private final String openAiKey; + + private final String openAiEndpoint; + + private final Map additionalProperties; + + private CreateAzureOpenAiCredentialDto( + CreateAzureOpenAiCredentialDtoRegion region, + List models, + String openAiKey, + String openAiEndpoint, + Map additionalProperties) { + this.region = region; + this.models = models; + this.openAiKey = openAiKey; + this.openAiEndpoint = openAiEndpoint; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "azure-openai"; + } + + @JsonProperty("region") + public CreateAzureOpenAiCredentialDtoRegion getRegion() { + return region; + } + + @JsonProperty("models") + public List getModels() { + return models; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("openAIKey") + public String getOpenAiKey() { + return openAiKey; + } + + @JsonProperty("openAIEndpoint") + public String getOpenAiEndpoint() { + return openAiEndpoint; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAzureOpenAiCredentialDto && equalTo((CreateAzureOpenAiCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAzureOpenAiCredentialDto other) { + return region.equals(other.region) + && models.equals(other.models) + && openAiKey.equals(other.openAiKey) + && openAiEndpoint.equals(other.openAiEndpoint); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.region, this.models, this.openAiKey, this.openAiEndpoint); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RegionStage builder() { + return new Builder(); + } + + public interface RegionStage { + OpenAiKeyStage region(@NotNull CreateAzureOpenAiCredentialDtoRegion region); + + Builder from(CreateAzureOpenAiCredentialDto other); + } + + public interface OpenAiKeyStage { + OpenAiEndpointStage openAiKey(@NotNull String openAiKey); + } + + public interface OpenAiEndpointStage { + _FinalStage openAiEndpoint(@NotNull String openAiEndpoint); + } + + public interface _FinalStage { + CreateAzureOpenAiCredentialDto build(); + + _FinalStage models(List models); + + _FinalStage addModels(CreateAzureOpenAiCredentialDtoModelsItem models); + + _FinalStage addAllModels(List models); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RegionStage, OpenAiKeyStage, OpenAiEndpointStage, _FinalStage { + private CreateAzureOpenAiCredentialDtoRegion region; + + private String openAiKey; + + private String openAiEndpoint; + + private List models = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAzureOpenAiCredentialDto other) { + region(other.getRegion()); + models(other.getModels()); + openAiKey(other.getOpenAiKey()); + openAiEndpoint(other.getOpenAiEndpoint()); + return this; + } + + @java.lang.Override + @JsonSetter("region") + public OpenAiKeyStage region(@NotNull CreateAzureOpenAiCredentialDtoRegion region) { + this.region = Objects.requireNonNull(region, "region must not be null"); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("openAIKey") + public OpenAiEndpointStage openAiKey(@NotNull String openAiKey) { + this.openAiKey = Objects.requireNonNull(openAiKey, "openAiKey must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("openAIEndpoint") + public _FinalStage openAiEndpoint(@NotNull String openAiEndpoint) { + this.openAiEndpoint = Objects.requireNonNull(openAiEndpoint, "openAiEndpoint must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllModels(List models) { + this.models.addAll(models); + return this; + } + + @java.lang.Override + public _FinalStage addModels(CreateAzureOpenAiCredentialDtoModelsItem models) { + this.models.add(models); + return this; + } + + @java.lang.Override + @JsonSetter(value = "models", nulls = Nulls.SKIP) + public _FinalStage models(List models) { + this.models.clear(); + this.models.addAll(models); + return this; + } + + @java.lang.Override + public CreateAzureOpenAiCredentialDto build() { + return new CreateAzureOpenAiCredentialDto(region, models, openAiKey, openAiEndpoint, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateAzureOpenAiCredentialDtoModelsItem.java b/src/main/java/com/vapi/api/types/CreateAzureOpenAiCredentialDtoModelsItem.java new file mode 100644 index 0000000..23d211b --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateAzureOpenAiCredentialDtoModelsItem.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CreateAzureOpenAiCredentialDtoModelsItem { + GPT_4_O_MINI_20240718("gpt-4o-mini-2024-07-18"), + + GPT_4_O_20240513("gpt-4o-2024-05-13"), + + GPT_4_TURBO_20240409("gpt-4-turbo-2024-04-09"), + + GPT_40125_PREVIEW("gpt-4-0125-preview"), + + GPT_41106_PREVIEW("gpt-4-1106-preview"), + + GPT_40613("gpt-4-0613"), + + GPT_35_TURBO_0125("gpt-35-turbo-0125"), + + GPT_35_TURBO_1106("gpt-35-turbo-1106"); + + private final String value; + + CreateAzureOpenAiCredentialDtoModelsItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CreateAzureOpenAiCredentialDtoRegion.java b/src/main/java/com/vapi/api/types/CreateAzureOpenAiCredentialDtoRegion.java new file mode 100644 index 0000000..4592cd6 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateAzureOpenAiCredentialDtoRegion.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CreateAzureOpenAiCredentialDtoRegion { + AUSTRALIA("australia"), + + CANADA("canada"), + + EASTUS_2("eastus2"), + + EASTUS("eastus"), + + FRANCE("france"), + + INDIA("india"), + + JAPAN("japan"), + + NORTHCENTRALUS("northcentralus"), + + NORWAY("norway"), + + SOUTHCENTRALUS("southcentralus"), + + SWEDEN("sweden"), + + SWITZERLAND("switzerland"), + + UK("uk"), + + WESTUS("westus"), + + WESTUS_3("westus3"); + + private final String value; + + CreateAzureOpenAiCredentialDtoRegion(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CreateByoPhoneNumberDto.java b/src/main/java/com/vapi/api/types/CreateByoPhoneNumberDto.java new file mode 100644 index 0000000..5a510f0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateByoPhoneNumberDto.java @@ -0,0 +1,467 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateByoPhoneNumberDto.Builder.class) +public final class CreateByoPhoneNumberDto { + private final Optional fallbackDestination; + + private final Optional numberE164CheckEnabled; + + private final Optional number; + + private final String credentialId; + + private final Optional name; + + private final Optional assistantId; + + private final Optional squadId; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Map additionalProperties; + + private CreateByoPhoneNumberDto( + Optional fallbackDestination, + Optional numberE164CheckEnabled, + Optional number, + String credentialId, + Optional name, + Optional assistantId, + Optional squadId, + Optional serverUrl, + Optional serverUrlSecret, + Map additionalProperties) { + this.fallbackDestination = fallbackDestination; + this.numberE164CheckEnabled = numberE164CheckEnabled; + this.number = number; + this.credentialId = credentialId; + this.name = name; + this.assistantId = assistantId; + this.squadId = squadId; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the fallback destination an inbound call will be transferred to if: + *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ */ + @JsonProperty("fallbackDestination") + public Optional getFallbackDestination() { + return fallbackDestination; + } + + /** + * @return This is the flag to toggle the E164 check for the number field. This is an advanced property which should be used if you know your use case requires it. + *

Use cases:

+ *
    + *
  • false: To allow non-E164 numbers like +001234567890, 1234, or abc. This is useful for dialing out to non-E164 numbers on your SIP trunks.
  • + *
  • true (default): To allow only E164 numbers like +14155551234. This is standard for PSTN calls.
  • + *
+ *

If false, the number is still required to only contain alphanumeric characters (regex: /^\+?[a-zA-Z0-9]+$/).

+ *

@default true (E164 check is enabled)

+ */ + @JsonProperty("numberE164CheckEnabled") + public Optional getNumberE164CheckEnabled() { + return numberE164CheckEnabled; + } + + /** + * @return This is the number of the customer. + */ + @JsonProperty("number") + public Optional getNumber() { + return number; + } + + /** + * @return This is the credential of your own SIP trunk or Carrier (type byo-sip-trunk) which can be used to make calls to this phone number. + *

You can add the SIP trunk or Carrier credential in the Provider Credentials page on the Dashboard to get the credentialId.

+ */ + @JsonProperty("credentialId") + public String getCredentialId() { + return credentialId; + } + + /** + * @return This is the name of the phone number. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the assistant that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the squad that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message. + *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateByoPhoneNumberDto && equalTo((CreateByoPhoneNumberDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateByoPhoneNumberDto other) { + return fallbackDestination.equals(other.fallbackDestination) + && numberE164CheckEnabled.equals(other.numberE164CheckEnabled) + && number.equals(other.number) + && credentialId.equals(other.credentialId) + && name.equals(other.name) + && assistantId.equals(other.assistantId) + && squadId.equals(other.squadId) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fallbackDestination, + this.numberE164CheckEnabled, + this.number, + this.credentialId, + this.name, + this.assistantId, + this.squadId, + this.serverUrl, + this.serverUrlSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CredentialIdStage builder() { + return new Builder(); + } + + public interface CredentialIdStage { + _FinalStage credentialId(@NotNull String credentialId); + + Builder from(CreateByoPhoneNumberDto other); + } + + public interface _FinalStage { + CreateByoPhoneNumberDto build(); + + _FinalStage fallbackDestination(Optional fallbackDestination); + + _FinalStage fallbackDestination(CreateByoPhoneNumberDtoFallbackDestination fallbackDestination); + + _FinalStage numberE164CheckEnabled(Optional numberE164CheckEnabled); + + _FinalStage numberE164CheckEnabled(Boolean numberE164CheckEnabled); + + _FinalStage number(Optional number); + + _FinalStage number(String number); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage assistantId(Optional assistantId); + + _FinalStage assistantId(String assistantId); + + _FinalStage squadId(Optional squadId); + + _FinalStage squadId(String squadId); + + _FinalStage serverUrl(Optional serverUrl); + + _FinalStage serverUrl(String serverUrl); + + _FinalStage serverUrlSecret(Optional serverUrlSecret); + + _FinalStage serverUrlSecret(String serverUrlSecret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CredentialIdStage, _FinalStage { + private String credentialId; + + private Optional serverUrlSecret = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional number = Optional.empty(); + + private Optional numberE164CheckEnabled = Optional.empty(); + + private Optional fallbackDestination = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateByoPhoneNumberDto other) { + fallbackDestination(other.getFallbackDestination()); + numberE164CheckEnabled(other.getNumberE164CheckEnabled()); + number(other.getNumber()); + credentialId(other.getCredentialId()); + name(other.getName()); + assistantId(other.getAssistantId()); + squadId(other.getSquadId()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + return this; + } + + /** + *

This is the credential of your own SIP trunk or Carrier (type byo-sip-trunk) which can be used to make calls to this phone number.

+ *

You can add the SIP trunk or Carrier credential in the Provider Credentials page on the Dashboard to get the credentialId.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("credentialId") + public _FinalStage credentialId(@NotNull String credentialId) { + this.credentialId = Objects.requireNonNull(credentialId, "credentialId must not be null"); + return this; + } + + /** + *

This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret.

+ *

Same precedence logic as serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public _FinalStage serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + /** + *

This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message.

+ *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public _FinalStage serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + /** + *

This is the squad that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public _FinalStage squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + /** + *

This is the assistant that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public _FinalStage assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + /** + *

This is the name of the phone number. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the number of the customer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage number(String number) { + this.number = Optional.ofNullable(number); + return this; + } + + @java.lang.Override + @JsonSetter(value = "number", nulls = Nulls.SKIP) + public _FinalStage number(Optional number) { + this.number = number; + return this; + } + + /** + *

This is the flag to toggle the E164 check for the number field. This is an advanced property which should be used if you know your use case requires it.

+ *

Use cases:

+ *
    + *
  • false: To allow non-E164 numbers like +001234567890, 1234, or abc. This is useful for dialing out to non-E164 numbers on your SIP trunks.
  • + *
  • true (default): To allow only E164 numbers like +14155551234. This is standard for PSTN calls.
  • + *
+ *

If false, the number is still required to only contain alphanumeric characters (regex: /^\+?[a-zA-Z0-9]+$/).

+ *

@default true (E164 check is enabled)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numberE164CheckEnabled(Boolean numberE164CheckEnabled) { + this.numberE164CheckEnabled = Optional.ofNullable(numberE164CheckEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "numberE164CheckEnabled", nulls = Nulls.SKIP) + public _FinalStage numberE164CheckEnabled(Optional numberE164CheckEnabled) { + this.numberE164CheckEnabled = numberE164CheckEnabled; + return this; + } + + /** + *

This is the fallback destination an inbound call will be transferred to if:

+ *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fallbackDestination(CreateByoPhoneNumberDtoFallbackDestination fallbackDestination) { + this.fallbackDestination = Optional.ofNullable(fallbackDestination); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fallbackDestination", nulls = Nulls.SKIP) + public _FinalStage fallbackDestination( + Optional fallbackDestination) { + this.fallbackDestination = fallbackDestination; + return this; + } + + @java.lang.Override + public CreateByoPhoneNumberDto build() { + return new CreateByoPhoneNumberDto( + fallbackDestination, + numberE164CheckEnabled, + number, + credentialId, + name, + assistantId, + squadId, + serverUrl, + serverUrlSecret, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateByoPhoneNumberDtoFallbackDestination.java b/src/main/java/com/vapi/api/types/CreateByoPhoneNumberDtoFallbackDestination.java new file mode 100644 index 0000000..74c567c --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateByoPhoneNumberDtoFallbackDestination.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateByoPhoneNumberDtoFallbackDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateByoPhoneNumberDtoFallbackDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateByoPhoneNumberDtoFallbackDestination number(TransferDestinationNumber value) { + return new CreateByoPhoneNumberDtoFallbackDestination(new NumberValue(value)); + } + + public static CreateByoPhoneNumberDtoFallbackDestination sip(TransferDestinationSip value) { + return new CreateByoPhoneNumberDtoFallbackDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateByoPhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateByoPhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateByoPhoneNumberDtoFallbackDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateByoSipTrunkCredentialDto.java b/src/main/java/com/vapi/api/types/CreateByoSipTrunkCredentialDto.java new file mode 100644 index 0000000..2e2cc0f --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateByoSipTrunkCredentialDto.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateByoSipTrunkCredentialDto.Builder.class) +public final class CreateByoSipTrunkCredentialDto { + private final Optional provider; + + private final List gateways; + + private final Optional name; + + private final Optional outboundAuthenticationPlan; + + private final Optional outboundLeadingPlusEnabled; + + private final Optional sbcConfiguration; + + private final Map additionalProperties; + + private CreateByoSipTrunkCredentialDto( + Optional provider, + List gateways, + Optional name, + Optional outboundAuthenticationPlan, + Optional outboundLeadingPlusEnabled, + Optional sbcConfiguration, + Map additionalProperties) { + this.provider = provider; + this.gateways = gateways; + this.name = name; + this.outboundAuthenticationPlan = outboundAuthenticationPlan; + this.outboundLeadingPlusEnabled = outboundLeadingPlusEnabled; + this.sbcConfiguration = sbcConfiguration; + this.additionalProperties = additionalProperties; + } + + /** + * @return This can be used to bring your own SIP trunks or to connect to a Carrier. + */ + @JsonProperty("provider") + public Optional getProvider() { + return provider; + } + + /** + * @return This is the list of SIP trunk's gateways. + */ + @JsonProperty("gateways") + public List getGateways() { + return gateways; + } + + /** + * @return This is the name of the SIP trunk. This is just for your reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This can be used to configure the outbound authentication if required by the SIP trunk. + */ + @JsonProperty("outboundAuthenticationPlan") + public Optional getOutboundAuthenticationPlan() { + return outboundAuthenticationPlan; + } + + /** + * @return This ensures the outbound origination attempts have a leading plus. Defaults to false to match conventional telecom behavior. + *

Usage:

+ *
    + *
  • Vonage/Twilio requires leading plus for all outbound calls. Set this to true.
  • + *
+ *

@default false

+ */ + @JsonProperty("outboundLeadingPlusEnabled") + public Optional getOutboundLeadingPlusEnabled() { + return outboundLeadingPlusEnabled; + } + + /** + * @return This is an advanced configuration for enterprise deployments. This uses the onprem SBC to trunk into the SIP trunk's gateways, rather than the managed SBC provided by Vapi. + */ + @JsonProperty("sbcConfiguration") + public Optional getSbcConfiguration() { + return sbcConfiguration; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateByoSipTrunkCredentialDto && equalTo((CreateByoSipTrunkCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateByoSipTrunkCredentialDto other) { + return provider.equals(other.provider) + && gateways.equals(other.gateways) + && name.equals(other.name) + && outboundAuthenticationPlan.equals(other.outboundAuthenticationPlan) + && outboundLeadingPlusEnabled.equals(other.outboundLeadingPlusEnabled) + && sbcConfiguration.equals(other.sbcConfiguration); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.provider, + this.gateways, + this.name, + this.outboundAuthenticationPlan, + this.outboundLeadingPlusEnabled, + this.sbcConfiguration); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional provider = Optional.empty(); + + private List gateways = new ArrayList<>(); + + private Optional name = Optional.empty(); + + private Optional outboundAuthenticationPlan = Optional.empty(); + + private Optional outboundLeadingPlusEnabled = Optional.empty(); + + private Optional sbcConfiguration = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateByoSipTrunkCredentialDto other) { + provider(other.getProvider()); + gateways(other.getGateways()); + name(other.getName()); + outboundAuthenticationPlan(other.getOutboundAuthenticationPlan()); + outboundLeadingPlusEnabled(other.getOutboundLeadingPlusEnabled()); + sbcConfiguration(other.getSbcConfiguration()); + return this; + } + + @JsonSetter(value = "provider", nulls = Nulls.SKIP) + public Builder provider(Optional provider) { + this.provider = provider; + return this; + } + + public Builder provider(String provider) { + this.provider = Optional.ofNullable(provider); + return this; + } + + @JsonSetter(value = "gateways", nulls = Nulls.SKIP) + public Builder gateways(List gateways) { + this.gateways.clear(); + this.gateways.addAll(gateways); + return this; + } + + public Builder addGateways(SipTrunkGateway gateways) { + this.gateways.add(gateways); + return this; + } + + public Builder addAllGateways(List gateways) { + this.gateways.addAll(gateways); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "outboundAuthenticationPlan", nulls = Nulls.SKIP) + public Builder outboundAuthenticationPlan( + Optional outboundAuthenticationPlan) { + this.outboundAuthenticationPlan = outboundAuthenticationPlan; + return this; + } + + public Builder outboundAuthenticationPlan(SipTrunkOutboundAuthenticationPlan outboundAuthenticationPlan) { + this.outboundAuthenticationPlan = Optional.ofNullable(outboundAuthenticationPlan); + return this; + } + + @JsonSetter(value = "outboundLeadingPlusEnabled", nulls = Nulls.SKIP) + public Builder outboundLeadingPlusEnabled(Optional outboundLeadingPlusEnabled) { + this.outboundLeadingPlusEnabled = outboundLeadingPlusEnabled; + return this; + } + + public Builder outboundLeadingPlusEnabled(Boolean outboundLeadingPlusEnabled) { + this.outboundLeadingPlusEnabled = Optional.ofNullable(outboundLeadingPlusEnabled); + return this; + } + + @JsonSetter(value = "sbcConfiguration", nulls = Nulls.SKIP) + public Builder sbcConfiguration(Optional sbcConfiguration) { + this.sbcConfiguration = sbcConfiguration; + return this; + } + + public Builder sbcConfiguration(SbcConfiguration sbcConfiguration) { + this.sbcConfiguration = Optional.ofNullable(sbcConfiguration); + return this; + } + + public CreateByoSipTrunkCredentialDto build() { + return new CreateByoSipTrunkCredentialDto( + provider, + gateways, + name, + outboundAuthenticationPlan, + outboundLeadingPlusEnabled, + sbcConfiguration, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateCartesiaCredentialDto.java b/src/main/java/com/vapi/api/types/CreateCartesiaCredentialDto.java new file mode 100644 index 0000000..ea875b1 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateCartesiaCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCartesiaCredentialDto.Builder.class) +public final class CreateCartesiaCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreateCartesiaCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "cartesia"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCartesiaCredentialDto && equalTo((CreateCartesiaCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCartesiaCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateCartesiaCredentialDto other); + } + + public interface _FinalStage { + CreateCartesiaCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCartesiaCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateCartesiaCredentialDto build() { + return new CreateCartesiaCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateConversationBlockDto.java b/src/main/java/com/vapi/api/types/CreateConversationBlockDto.java new file mode 100644 index 0000000..ee72e57 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateConversationBlockDto.java @@ -0,0 +1,337 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateConversationBlockDto.Builder.class) +public final class CreateConversationBlockDto { + private final Optional> messages; + + private final Optional inputSchema; + + private final Optional outputSchema; + + private final String instruction; + + private final Optional name; + + private final Map additionalProperties; + + private CreateConversationBlockDto( + Optional> messages, + Optional inputSchema, + Optional outputSchema, + String instruction, + Optional name, + Map additionalProperties) { + this.messages = messages; + this.inputSchema = inputSchema; + this.outputSchema = outputSchema; + this.instruction = instruction; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the pre-configured messages that will be spoken to the user while the block is running. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the input schema for the block. This is the input the block needs to run. It's given to the block as steps[0].input + *

These are accessible as variables:

+ *
    + *
  • ({{input.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.input.propertyName}}) in context of the workflow
  • + *
+ */ + @JsonProperty("inputSchema") + public Optional getInputSchema() { + return inputSchema; + } + + /** + * @return This is the output schema for the block. This is the output the block will return to the workflow ({{stepName.output}}). + *

These are accessible as variables:

+ *
    + *
  • ({{output.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
  • + *
  • ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2)
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ */ + @JsonProperty("outputSchema") + public Optional getOutputSchema() { + return outputSchema; + } + + /** + * @return This is the instruction to the model. + *

You can reference any variable in the context of the current block execution (step):

+ *
    + *
  • "{{input.your-property-name}}" for the current step's input
  • + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • + *
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

This can be as simple or as complex as you want it to be.

+ *
    + *
  • "say hello and ask the user about their day!"
  • + *
  • "collect the user's first and last name"
  • + *
  • "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}. ask them about their salary and if they might be interested in buying a house. we offer {{input.offer}}"
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output/input.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output/input.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ */ + @JsonProperty("instruction") + public String getInstruction() { + return instruction; + } + + /** + * @return This is the name of the block. This is just for your reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateConversationBlockDto && equalTo((CreateConversationBlockDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateConversationBlockDto other) { + return messages.equals(other.messages) + && inputSchema.equals(other.inputSchema) + && outputSchema.equals(other.outputSchema) + && instruction.equals(other.instruction) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.messages, this.inputSchema, this.outputSchema, this.instruction, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static InstructionStage builder() { + return new Builder(); + } + + public interface InstructionStage { + _FinalStage instruction(@NotNull String instruction); + + Builder from(CreateConversationBlockDto other); + } + + public interface _FinalStage { + CreateConversationBlockDto build(); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage inputSchema(Optional inputSchema); + + _FinalStage inputSchema(JsonSchema inputSchema); + + _FinalStage outputSchema(Optional outputSchema); + + _FinalStage outputSchema(JsonSchema outputSchema); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements InstructionStage, _FinalStage { + private String instruction; + + private Optional name = Optional.empty(); + + private Optional outputSchema = Optional.empty(); + + private Optional inputSchema = Optional.empty(); + + private Optional> messages = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateConversationBlockDto other) { + messages(other.getMessages()); + inputSchema(other.getInputSchema()); + outputSchema(other.getOutputSchema()); + instruction(other.getInstruction()); + name(other.getName()); + return this; + } + + /** + *

This is the instruction to the model.

+ *

You can reference any variable in the context of the current block execution (step):

+ *
    + *
  • "{{input.your-property-name}}" for the current step's input
  • + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • + *
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

This can be as simple or as complex as you want it to be.

+ *
    + *
  • "say hello and ask the user about their day!"
  • + *
  • "collect the user's first and last name"
  • + *
  • "user is {{input.firstName}} {{input.lastName}}. their age is {{input.age}}. ask them about their salary and if they might be interested in buying a house. we offer {{input.offer}}"
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output/input.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output/input.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("instruction") + public _FinalStage instruction(@NotNull String instruction) { + this.instruction = Objects.requireNonNull(instruction, "instruction must not be null"); + return this; + } + + /** + *

This is the name of the block. This is just for your reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the output schema for the block. This is the output the block will return to the workflow ({{stepName.output}}).

+ *

These are accessible as variables:

+ *
    + *
  • ({{output.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
  • + *
  • ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2)
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage outputSchema(JsonSchema outputSchema) { + this.outputSchema = Optional.ofNullable(outputSchema); + return this; + } + + @java.lang.Override + @JsonSetter(value = "outputSchema", nulls = Nulls.SKIP) + public _FinalStage outputSchema(Optional outputSchema) { + this.outputSchema = outputSchema; + return this; + } + + /** + *

This is the input schema for the block. This is the input the block needs to run. It's given to the block as steps[0].input

+ *

These are accessible as variables:

+ *
    + *
  • ({{input.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.input.propertyName}}) in context of the workflow
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage inputSchema(JsonSchema inputSchema) { + this.inputSchema = Optional.ofNullable(inputSchema); + return this; + } + + @java.lang.Override + @JsonSetter(value = "inputSchema", nulls = Nulls.SKIP) + public _FinalStage inputSchema(Optional inputSchema) { + this.inputSchema = inputSchema; + return this; + } + + /** + *

These are the pre-configured messages that will be spoken to the user while the block is running.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + @java.lang.Override + public CreateConversationBlockDto build() { + return new CreateConversationBlockDto( + messages, inputSchema, outputSchema, instruction, name, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateConversationBlockDtoMessagesItem.java b/src/main/java/com/vapi/api/types/CreateConversationBlockDtoMessagesItem.java new file mode 100644 index 0000000..fc1df36 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateConversationBlockDtoMessagesItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateConversationBlockDtoMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateConversationBlockDtoMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateConversationBlockDtoMessagesItem blockStart(BlockStartMessage value) { + return new CreateConversationBlockDtoMessagesItem(new BlockStartValue(value)); + } + + public static CreateConversationBlockDtoMessagesItem blockComplete(BlockCompleteMessage value) { + return new CreateConversationBlockDtoMessagesItem(new BlockCompleteValue(value)); + } + + public boolean isBlockStart() { + return value instanceof BlockStartValue; + } + + public boolean isBlockComplete() { + return value instanceof BlockCompleteValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getBlockStart() { + if (isBlockStart()) { + return Optional.of(((BlockStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getBlockComplete() { + if (isBlockComplete()) { + return Optional.of(((BlockCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitBlockStart(BlockStartMessage blockStart); + + T visitBlockComplete(BlockCompleteMessage blockComplete); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(BlockStartValue.class), @JsonSubTypes.Type(BlockCompleteValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("block-start") + private static final class BlockStartValue implements Value { + @JsonUnwrapped + private BlockStartMessage value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BlockStartValue() {} + + private BlockStartValue(BlockStartMessage value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBlockStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockStartValue && equalTo((BlockStartValue) other); + } + + private boolean equalTo(BlockStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateConversationBlockDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("block-complete") + private static final class BlockCompleteValue implements Value { + @JsonUnwrapped + private BlockCompleteMessage value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BlockCompleteValue() {} + + private BlockCompleteValue(BlockCompleteMessage value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBlockComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockCompleteValue && equalTo((BlockCompleteValue) other); + } + + private boolean equalTo(BlockCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateConversationBlockDtoMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateConversationBlockDtoMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateCustomLlmCredentialDto.java b/src/main/java/com/vapi/api/types/CreateCustomLlmCredentialDto.java new file mode 100644 index 0000000..84faf56 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateCustomLlmCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCustomLlmCredentialDto.Builder.class) +public final class CreateCustomLlmCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreateCustomLlmCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "custom-llm"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCustomLlmCredentialDto && equalTo((CreateCustomLlmCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCustomLlmCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateCustomLlmCredentialDto other); + } + + public interface _FinalStage { + CreateCustomLlmCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateCustomLlmCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateCustomLlmCredentialDto build() { + return new CreateCustomLlmCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateCustomerDto.java b/src/main/java/com/vapi/api/types/CreateCustomerDto.java new file mode 100644 index 0000000..e5307af --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateCustomerDto.java @@ -0,0 +1,216 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateCustomerDto.Builder.class) +public final class CreateCustomerDto { + private final Optional numberE164CheckEnabled; + + private final Optional extension; + + private final Optional number; + + private final Optional sipUri; + + private final Optional name; + + private final Map additionalProperties; + + private CreateCustomerDto( + Optional numberE164CheckEnabled, + Optional extension, + Optional number, + Optional sipUri, + Optional name, + Map additionalProperties) { + this.numberE164CheckEnabled = numberE164CheckEnabled; + this.extension = extension; + this.number = number; + this.sipUri = sipUri; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the flag to toggle the E164 check for the number field. This is an advanced property which should be used if you know your use case requires it. + *

Use cases:

+ *
    + *
  • false: To allow non-E164 numbers like +001234567890, 1234, or abc. This is useful for dialing out to non-E164 numbers on your SIP trunks.
  • + *
  • true (default): To allow only E164 numbers like +14155551234. This is standard for PSTN calls.
  • + *
+ *

If false, the number is still required to only contain alphanumeric characters (regex: /^\+?[a-zA-Z0-9]+$/).

+ *

@default true (E164 check is enabled)

+ */ + @JsonProperty("numberE164CheckEnabled") + public Optional getNumberE164CheckEnabled() { + return numberE164CheckEnabled; + } + + /** + * @return This is the extension that will be dialed after the call is answered. + */ + @JsonProperty("extension") + public Optional getExtension() { + return extension; + } + + /** + * @return This is the number of the customer. + */ + @JsonProperty("number") + public Optional getNumber() { + return number; + } + + /** + * @return This is the SIP URI of the customer. + */ + @JsonProperty("sipUri") + public Optional getSipUri() { + return sipUri; + } + + /** + * @return This is the name of the customer. This is just for your own reference. + *

For SIP inbound calls, this is extracted from the From SIP header with format "Display Name" <sip:username@domain>.

+ */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateCustomerDto && equalTo((CreateCustomerDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateCustomerDto other) { + return numberE164CheckEnabled.equals(other.numberE164CheckEnabled) + && extension.equals(other.extension) + && number.equals(other.number) + && sipUri.equals(other.sipUri) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.numberE164CheckEnabled, this.extension, this.number, this.sipUri, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional numberE164CheckEnabled = Optional.empty(); + + private Optional extension = Optional.empty(); + + private Optional number = Optional.empty(); + + private Optional sipUri = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateCustomerDto other) { + numberE164CheckEnabled(other.getNumberE164CheckEnabled()); + extension(other.getExtension()); + number(other.getNumber()); + sipUri(other.getSipUri()); + name(other.getName()); + return this; + } + + @JsonSetter(value = "numberE164CheckEnabled", nulls = Nulls.SKIP) + public Builder numberE164CheckEnabled(Optional numberE164CheckEnabled) { + this.numberE164CheckEnabled = numberE164CheckEnabled; + return this; + } + + public Builder numberE164CheckEnabled(Boolean numberE164CheckEnabled) { + this.numberE164CheckEnabled = Optional.ofNullable(numberE164CheckEnabled); + return this; + } + + @JsonSetter(value = "extension", nulls = Nulls.SKIP) + public Builder extension(Optional extension) { + this.extension = extension; + return this; + } + + public Builder extension(String extension) { + this.extension = Optional.ofNullable(extension); + return this; + } + + @JsonSetter(value = "number", nulls = Nulls.SKIP) + public Builder number(Optional number) { + this.number = number; + return this; + } + + public Builder number(String number) { + this.number = Optional.ofNullable(number); + return this; + } + + @JsonSetter(value = "sipUri", nulls = Nulls.SKIP) + public Builder sipUri(Optional sipUri) { + this.sipUri = sipUri; + return this; + } + + public Builder sipUri(String sipUri) { + this.sipUri = Optional.ofNullable(sipUri); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public CreateCustomerDto build() { + return new CreateCustomerDto(numberE164CheckEnabled, extension, number, sipUri, name, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateDeepInfraCredentialDto.java b/src/main/java/com/vapi/api/types/CreateDeepInfraCredentialDto.java new file mode 100644 index 0000000..e546d6b --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateDeepInfraCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateDeepInfraCredentialDto.Builder.class) +public final class CreateDeepInfraCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreateDeepInfraCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "deepinfra"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateDeepInfraCredentialDto && equalTo((CreateDeepInfraCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateDeepInfraCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateDeepInfraCredentialDto other); + } + + public interface _FinalStage { + CreateDeepInfraCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateDeepInfraCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateDeepInfraCredentialDto build() { + return new CreateDeepInfraCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateDeepgramCredentialDto.java b/src/main/java/com/vapi/api/types/CreateDeepgramCredentialDto.java new file mode 100644 index 0000000..532be9b --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateDeepgramCredentialDto.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateDeepgramCredentialDto.Builder.class) +public final class CreateDeepgramCredentialDto { + private final String apiKey; + + private final Optional apiUrl; + + private final Map additionalProperties; + + private CreateDeepgramCredentialDto( + String apiKey, Optional apiUrl, Map additionalProperties) { + this.apiKey = apiKey; + this.apiUrl = apiUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "deepgram"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This can be used to point to an onprem Deepgram instance. Defaults to api.deepgram.com. + */ + @JsonProperty("apiUrl") + public Optional getApiUrl() { + return apiUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateDeepgramCredentialDto && equalTo((CreateDeepgramCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateDeepgramCredentialDto other) { + return apiKey.equals(other.apiKey) && apiUrl.equals(other.apiUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.apiUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateDeepgramCredentialDto other); + } + + public interface _FinalStage { + CreateDeepgramCredentialDto build(); + + _FinalStage apiUrl(Optional apiUrl); + + _FinalStage apiUrl(String apiUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + private Optional apiUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateDeepgramCredentialDto other) { + apiKey(other.getApiKey()); + apiUrl(other.getApiUrl()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This can be used to point to an onprem Deepgram instance. Defaults to api.deepgram.com.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiUrl(String apiUrl) { + this.apiUrl = Optional.ofNullable(apiUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "apiUrl", nulls = Nulls.SKIP) + public _FinalStage apiUrl(Optional apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + @java.lang.Override + public CreateDeepgramCredentialDto build() { + return new CreateDeepgramCredentialDto(apiKey, apiUrl, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateDtmfToolDto.java b/src/main/java/com/vapi/api/types/CreateDtmfToolDto.java new file mode 100644 index 0000000..5ab0a38 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateDtmfToolDto.java @@ -0,0 +1,190 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateDtmfToolDto.Builder.class) +public final class CreateDtmfToolDto { + private final Optional async; + + private final Optional> messages; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private CreateDtmfToolDto( + Optional async, + Optional> messages, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateDtmfToolDto && equalTo((CreateDtmfToolDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateDtmfToolDto other) { + return async.equals(other.async) + && messages.equals(other.messages) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.async, this.messages, this.function, this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional async = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional server = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateDtmfToolDto other) { + async(other.getAsync()); + messages(other.getMessages()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public Builder async(Optional async) { + this.async = async; + return this; + } + + public Builder async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public Builder function(Optional function) { + this.function = function; + return this; + } + + public Builder function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public Builder server(Optional server) { + this.server = server; + return this; + } + + public Builder server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + public CreateDtmfToolDto build() { + return new CreateDtmfToolDto(async, messages, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateDtmfToolDtoMessagesItem.java b/src/main/java/com/vapi/api/types/CreateDtmfToolDtoMessagesItem.java new file mode 100644 index 0000000..7be42c1 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateDtmfToolDtoMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateDtmfToolDtoMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateDtmfToolDtoMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateDtmfToolDtoMessagesItem requestStart(ToolMessageStart value) { + return new CreateDtmfToolDtoMessagesItem(new RequestStartValue(value)); + } + + public static CreateDtmfToolDtoMessagesItem requestComplete(ToolMessageComplete value) { + return new CreateDtmfToolDtoMessagesItem(new RequestCompleteValue(value)); + } + + public static CreateDtmfToolDtoMessagesItem requestFailed(ToolMessageFailed value) { + return new CreateDtmfToolDtoMessagesItem(new RequestFailedValue(value)); + } + + public static CreateDtmfToolDtoMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new CreateDtmfToolDtoMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateDtmfToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateDtmfToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateDtmfToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateDtmfToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateDtmfToolDtoMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateElevenLabsCredentialDto.java b/src/main/java/com/vapi/api/types/CreateElevenLabsCredentialDto.java new file mode 100644 index 0000000..914fdaf --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateElevenLabsCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateElevenLabsCredentialDto.Builder.class) +public final class CreateElevenLabsCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreateElevenLabsCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "11labs"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateElevenLabsCredentialDto && equalTo((CreateElevenLabsCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateElevenLabsCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateElevenLabsCredentialDto other); + } + + public interface _FinalStage { + CreateElevenLabsCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateElevenLabsCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateElevenLabsCredentialDto build() { + return new CreateElevenLabsCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateEndCallToolDto.java b/src/main/java/com/vapi/api/types/CreateEndCallToolDto.java new file mode 100644 index 0000000..7626e4f --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateEndCallToolDto.java @@ -0,0 +1,190 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateEndCallToolDto.Builder.class) +public final class CreateEndCallToolDto { + private final Optional async; + + private final Optional> messages; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private CreateEndCallToolDto( + Optional async, + Optional> messages, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateEndCallToolDto && equalTo((CreateEndCallToolDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateEndCallToolDto other) { + return async.equals(other.async) + && messages.equals(other.messages) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.async, this.messages, this.function, this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional async = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional server = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateEndCallToolDto other) { + async(other.getAsync()); + messages(other.getMessages()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public Builder async(Optional async) { + this.async = async; + return this; + } + + public Builder async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public Builder function(Optional function) { + this.function = function; + return this; + } + + public Builder function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public Builder server(Optional server) { + this.server = server; + return this; + } + + public Builder server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + public CreateEndCallToolDto build() { + return new CreateEndCallToolDto(async, messages, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateEndCallToolDtoMessagesItem.java b/src/main/java/com/vapi/api/types/CreateEndCallToolDtoMessagesItem.java new file mode 100644 index 0000000..5b22e3b --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateEndCallToolDtoMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateEndCallToolDtoMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateEndCallToolDtoMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateEndCallToolDtoMessagesItem requestStart(ToolMessageStart value) { + return new CreateEndCallToolDtoMessagesItem(new RequestStartValue(value)); + } + + public static CreateEndCallToolDtoMessagesItem requestComplete(ToolMessageComplete value) { + return new CreateEndCallToolDtoMessagesItem(new RequestCompleteValue(value)); + } + + public static CreateEndCallToolDtoMessagesItem requestFailed(ToolMessageFailed value) { + return new CreateEndCallToolDtoMessagesItem(new RequestFailedValue(value)); + } + + public static CreateEndCallToolDtoMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new CreateEndCallToolDtoMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateEndCallToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateEndCallToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateEndCallToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateEndCallToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateEndCallToolDtoMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateFunctionToolDto.java b/src/main/java/com/vapi/api/types/CreateFunctionToolDto.java new file mode 100644 index 0000000..a732cc3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateFunctionToolDto.java @@ -0,0 +1,190 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateFunctionToolDto.Builder.class) +public final class CreateFunctionToolDto { + private final Optional async; + + private final Optional> messages; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private CreateFunctionToolDto( + Optional async, + Optional> messages, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateFunctionToolDto && equalTo((CreateFunctionToolDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateFunctionToolDto other) { + return async.equals(other.async) + && messages.equals(other.messages) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.async, this.messages, this.function, this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional async = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional server = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateFunctionToolDto other) { + async(other.getAsync()); + messages(other.getMessages()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public Builder async(Optional async) { + this.async = async; + return this; + } + + public Builder async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public Builder function(Optional function) { + this.function = function; + return this; + } + + public Builder function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public Builder server(Optional server) { + this.server = server; + return this; + } + + public Builder server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + public CreateFunctionToolDto build() { + return new CreateFunctionToolDto(async, messages, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateFunctionToolDtoMessagesItem.java b/src/main/java/com/vapi/api/types/CreateFunctionToolDtoMessagesItem.java new file mode 100644 index 0000000..81bc267 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateFunctionToolDtoMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateFunctionToolDtoMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateFunctionToolDtoMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateFunctionToolDtoMessagesItem requestStart(ToolMessageStart value) { + return new CreateFunctionToolDtoMessagesItem(new RequestStartValue(value)); + } + + public static CreateFunctionToolDtoMessagesItem requestComplete(ToolMessageComplete value) { + return new CreateFunctionToolDtoMessagesItem(new RequestCompleteValue(value)); + } + + public static CreateFunctionToolDtoMessagesItem requestFailed(ToolMessageFailed value) { + return new CreateFunctionToolDtoMessagesItem(new RequestFailedValue(value)); + } + + public static CreateFunctionToolDtoMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new CreateFunctionToolDtoMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateFunctionToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateFunctionToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateFunctionToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateFunctionToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateFunctionToolDtoMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateGcpCredentialDto.java b/src/main/java/com/vapi/api/types/CreateGcpCredentialDto.java new file mode 100644 index 0000000..1e2eb1e --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateGcpCredentialDto.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateGcpCredentialDto.Builder.class) +public final class CreateGcpCredentialDto { + private final Optional name; + + private final GcpKey gcpKey; + + private final Optional bucketPlan; + + private final Map additionalProperties; + + private CreateGcpCredentialDto( + Optional name, + GcpKey gcpKey, + Optional bucketPlan, + Map additionalProperties) { + this.name = name; + this.gcpKey = gcpKey; + this.bucketPlan = bucketPlan; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "gcp"; + } + + /** + * @return This is the name of the GCP credential. This is just for your reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the GCP key. This is the JSON that can be generated in the Google Cloud Console at https://console.cloud.google.com/iam-admin/serviceaccounts/details/<service-account-id>/keys. + *

The schema is identical to the JSON that GCP outputs.

+ */ + @JsonProperty("gcpKey") + public GcpKey getGcpKey() { + return gcpKey; + } + + /** + * @return This is the bucket plan that can be provided to store call artifacts in GCP. + */ + @JsonProperty("bucketPlan") + public Optional getBucketPlan() { + return bucketPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateGcpCredentialDto && equalTo((CreateGcpCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateGcpCredentialDto other) { + return name.equals(other.name) && gcpKey.equals(other.gcpKey) && bucketPlan.equals(other.bucketPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.gcpKey, this.bucketPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static GcpKeyStage builder() { + return new Builder(); + } + + public interface GcpKeyStage { + _FinalStage gcpKey(@NotNull GcpKey gcpKey); + + Builder from(CreateGcpCredentialDto other); + } + + public interface _FinalStage { + CreateGcpCredentialDto build(); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage bucketPlan(Optional bucketPlan); + + _FinalStage bucketPlan(BucketPlan bucketPlan); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements GcpKeyStage, _FinalStage { + private GcpKey gcpKey; + + private Optional bucketPlan = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateGcpCredentialDto other) { + name(other.getName()); + gcpKey(other.getGcpKey()); + bucketPlan(other.getBucketPlan()); + return this; + } + + /** + *

This is the GCP key. This is the JSON that can be generated in the Google Cloud Console at https://console.cloud.google.com/iam-admin/serviceaccounts/details/<service-account-id>/keys.

+ *

The schema is identical to the JSON that GCP outputs.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("gcpKey") + public _FinalStage gcpKey(@NotNull GcpKey gcpKey) { + this.gcpKey = Objects.requireNonNull(gcpKey, "gcpKey must not be null"); + return this; + } + + /** + *

This is the bucket plan that can be provided to store call artifacts in GCP.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bucketPlan(BucketPlan bucketPlan) { + this.bucketPlan = Optional.ofNullable(bucketPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "bucketPlan", nulls = Nulls.SKIP) + public _FinalStage bucketPlan(Optional bucketPlan) { + this.bucketPlan = bucketPlan; + return this; + } + + /** + *

This is the name of the GCP credential. This is just for your reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public CreateGcpCredentialDto build() { + return new CreateGcpCredentialDto(name, gcpKey, bucketPlan, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateGhlToolDto.java b/src/main/java/com/vapi/api/types/CreateGhlToolDto.java new file mode 100644 index 0000000..830ff99 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateGhlToolDto.java @@ -0,0 +1,271 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateGhlToolDto.Builder.class) +public final class CreateGhlToolDto { + private final Optional async; + + private final Optional> messages; + + private final GhlToolMetadata metadata; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private CreateGhlToolDto( + Optional async, + Optional> messages, + GhlToolMetadata metadata, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.metadata = metadata; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + @JsonProperty("metadata") + public GhlToolMetadata getMetadata() { + return metadata; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateGhlToolDto && equalTo((CreateGhlToolDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateGhlToolDto other) { + return async.equals(other.async) + && messages.equals(other.messages) + && metadata.equals(other.metadata) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.async, this.messages, this.metadata, this.function, this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MetadataStage builder() { + return new Builder(); + } + + public interface MetadataStage { + _FinalStage metadata(@NotNull GhlToolMetadata metadata); + + Builder from(CreateGhlToolDto other); + } + + public interface _FinalStage { + CreateGhlToolDto build(); + + _FinalStage async(Optional async); + + _FinalStage async(Boolean async); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage function(Optional function); + + _FinalStage function(OpenAiFunction function); + + _FinalStage server(Optional server); + + _FinalStage server(Server server); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MetadataStage, _FinalStage { + private GhlToolMetadata metadata; + + private Optional server = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional async = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateGhlToolDto other) { + async(other.getAsync()); + messages(other.getMessages()); + metadata(other.getMetadata()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + @java.lang.Override + @JsonSetter("metadata") + public _FinalStage metadata(@NotNull GhlToolMetadata metadata) { + this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); + return this; + } + + /** + *

This is the server that will be hit when this tool is requested by the model.

+ *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + @java.lang.Override + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public _FinalStage server(Optional server) { + this.server = server; + return this; + } + + /** + *

This is the function definition of the tool.

+ *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @java.lang.Override + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public _FinalStage function(Optional function) { + this.function = function; + return this; + } + + /** + *

These are the messages that will be spoken to the user as the tool is running.

+ *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + /** + *

This determines if the tool is async.

+ *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @java.lang.Override + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public _FinalStage async(Optional async) { + this.async = async; + return this; + } + + @java.lang.Override + public CreateGhlToolDto build() { + return new CreateGhlToolDto(async, messages, metadata, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateGhlToolDtoMessagesItem.java b/src/main/java/com/vapi/api/types/CreateGhlToolDtoMessagesItem.java new file mode 100644 index 0000000..cc983c4 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateGhlToolDtoMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateGhlToolDtoMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateGhlToolDtoMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateGhlToolDtoMessagesItem requestStart(ToolMessageStart value) { + return new CreateGhlToolDtoMessagesItem(new RequestStartValue(value)); + } + + public static CreateGhlToolDtoMessagesItem requestComplete(ToolMessageComplete value) { + return new CreateGhlToolDtoMessagesItem(new RequestCompleteValue(value)); + } + + public static CreateGhlToolDtoMessagesItem requestFailed(ToolMessageFailed value) { + return new CreateGhlToolDtoMessagesItem(new RequestFailedValue(value)); + } + + public static CreateGhlToolDtoMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new CreateGhlToolDtoMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateGhlToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateGhlToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateGhlToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateGhlToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateGhlToolDtoMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateGladiaCredentialDto.java b/src/main/java/com/vapi/api/types/CreateGladiaCredentialDto.java new file mode 100644 index 0000000..238d468 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateGladiaCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateGladiaCredentialDto.Builder.class) +public final class CreateGladiaCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreateGladiaCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "gladia"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateGladiaCredentialDto && equalTo((CreateGladiaCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateGladiaCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateGladiaCredentialDto other); + } + + public interface _FinalStage { + CreateGladiaCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateGladiaCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateGladiaCredentialDto build() { + return new CreateGladiaCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateGoHighLevelCredentialDto.java b/src/main/java/com/vapi/api/types/CreateGoHighLevelCredentialDto.java new file mode 100644 index 0000000..966a947 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateGoHighLevelCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateGoHighLevelCredentialDto.Builder.class) +public final class CreateGoHighLevelCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreateGoHighLevelCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "gohighlevel"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateGoHighLevelCredentialDto && equalTo((CreateGoHighLevelCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateGoHighLevelCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateGoHighLevelCredentialDto other); + } + + public interface _FinalStage { + CreateGoHighLevelCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateGoHighLevelCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateGoHighLevelCredentialDto build() { + return new CreateGoHighLevelCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateGroqCredentialDto.java b/src/main/java/com/vapi/api/types/CreateGroqCredentialDto.java new file mode 100644 index 0000000..d8a37a0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateGroqCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateGroqCredentialDto.Builder.class) +public final class CreateGroqCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreateGroqCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "groq"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateGroqCredentialDto && equalTo((CreateGroqCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateGroqCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateGroqCredentialDto other); + } + + public interface _FinalStage { + CreateGroqCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateGroqCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateGroqCredentialDto build() { + return new CreateGroqCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateLmntCredentialDto.java b/src/main/java/com/vapi/api/types/CreateLmntCredentialDto.java new file mode 100644 index 0000000..331fab5 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateLmntCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateLmntCredentialDto.Builder.class) +public final class CreateLmntCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreateLmntCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "lmnt"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateLmntCredentialDto && equalTo((CreateLmntCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateLmntCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateLmntCredentialDto other); + } + + public interface _FinalStage { + CreateLmntCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateLmntCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateLmntCredentialDto build() { + return new CreateLmntCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateMakeCredentialDto.java b/src/main/java/com/vapi/api/types/CreateMakeCredentialDto.java new file mode 100644 index 0000000..d82f518 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateMakeCredentialDto.java @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateMakeCredentialDto.Builder.class) +public final class CreateMakeCredentialDto { + private final String teamId; + + private final String region; + + private final String apiKey; + + private final Map additionalProperties; + + private CreateMakeCredentialDto( + String teamId, String region, String apiKey, Map additionalProperties) { + this.teamId = teamId; + this.region = region; + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "make"; + } + + /** + * @return Team ID + */ + @JsonProperty("teamId") + public String getTeamId() { + return teamId; + } + + /** + * @return Region of your application. For example: eu1, eu2, us1, us2 + */ + @JsonProperty("region") + public String getRegion() { + return region; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateMakeCredentialDto && equalTo((CreateMakeCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateMakeCredentialDto other) { + return teamId.equals(other.teamId) && region.equals(other.region) && apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.teamId, this.region, this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TeamIdStage builder() { + return new Builder(); + } + + public interface TeamIdStage { + RegionStage teamId(@NotNull String teamId); + + Builder from(CreateMakeCredentialDto other); + } + + public interface RegionStage { + ApiKeyStage region(@NotNull String region); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + } + + public interface _FinalStage { + CreateMakeCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TeamIdStage, RegionStage, ApiKeyStage, _FinalStage { + private String teamId; + + private String region; + + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateMakeCredentialDto other) { + teamId(other.getTeamId()); + region(other.getRegion()); + apiKey(other.getApiKey()); + return this; + } + + /** + *

Team ID

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("teamId") + public RegionStage teamId(@NotNull String teamId) { + this.teamId = Objects.requireNonNull(teamId, "teamId must not be null"); + return this; + } + + /** + *

Region of your application. For example: eu1, eu2, us1, us2

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("region") + public ApiKeyStage region(@NotNull String region) { + this.region = Objects.requireNonNull(region, "region must not be null"); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateMakeCredentialDto build() { + return new CreateMakeCredentialDto(teamId, region, apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateMakeToolDto.java b/src/main/java/com/vapi/api/types/CreateMakeToolDto.java new file mode 100644 index 0000000..2af94ee --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateMakeToolDto.java @@ -0,0 +1,271 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateMakeToolDto.Builder.class) +public final class CreateMakeToolDto { + private final Optional async; + + private final Optional> messages; + + private final MakeToolMetadata metadata; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private CreateMakeToolDto( + Optional async, + Optional> messages, + MakeToolMetadata metadata, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.metadata = metadata; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + @JsonProperty("metadata") + public MakeToolMetadata getMetadata() { + return metadata; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateMakeToolDto && equalTo((CreateMakeToolDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateMakeToolDto other) { + return async.equals(other.async) + && messages.equals(other.messages) + && metadata.equals(other.metadata) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.async, this.messages, this.metadata, this.function, this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MetadataStage builder() { + return new Builder(); + } + + public interface MetadataStage { + _FinalStage metadata(@NotNull MakeToolMetadata metadata); + + Builder from(CreateMakeToolDto other); + } + + public interface _FinalStage { + CreateMakeToolDto build(); + + _FinalStage async(Optional async); + + _FinalStage async(Boolean async); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage function(Optional function); + + _FinalStage function(OpenAiFunction function); + + _FinalStage server(Optional server); + + _FinalStage server(Server server); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MetadataStage, _FinalStage { + private MakeToolMetadata metadata; + + private Optional server = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional async = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateMakeToolDto other) { + async(other.getAsync()); + messages(other.getMessages()); + metadata(other.getMetadata()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + @java.lang.Override + @JsonSetter("metadata") + public _FinalStage metadata(@NotNull MakeToolMetadata metadata) { + this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); + return this; + } + + /** + *

This is the server that will be hit when this tool is requested by the model.

+ *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + @java.lang.Override + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public _FinalStage server(Optional server) { + this.server = server; + return this; + } + + /** + *

This is the function definition of the tool.

+ *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @java.lang.Override + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public _FinalStage function(Optional function) { + this.function = function; + return this; + } + + /** + *

These are the messages that will be spoken to the user as the tool is running.

+ *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + /** + *

This determines if the tool is async.

+ *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @java.lang.Override + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public _FinalStage async(Optional async) { + this.async = async; + return this; + } + + @java.lang.Override + public CreateMakeToolDto build() { + return new CreateMakeToolDto(async, messages, metadata, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateMakeToolDtoMessagesItem.java b/src/main/java/com/vapi/api/types/CreateMakeToolDtoMessagesItem.java new file mode 100644 index 0000000..23976fd --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateMakeToolDtoMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateMakeToolDtoMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateMakeToolDtoMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateMakeToolDtoMessagesItem requestStart(ToolMessageStart value) { + return new CreateMakeToolDtoMessagesItem(new RequestStartValue(value)); + } + + public static CreateMakeToolDtoMessagesItem requestComplete(ToolMessageComplete value) { + return new CreateMakeToolDtoMessagesItem(new RequestCompleteValue(value)); + } + + public static CreateMakeToolDtoMessagesItem requestFailed(ToolMessageFailed value) { + return new CreateMakeToolDtoMessagesItem(new RequestFailedValue(value)); + } + + public static CreateMakeToolDtoMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new CreateMakeToolDtoMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateMakeToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateMakeToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateMakeToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateMakeToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateMakeToolDtoMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateOpenAiCredentialDto.java b/src/main/java/com/vapi/api/types/CreateOpenAiCredentialDto.java new file mode 100644 index 0000000..dafb714 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateOpenAiCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOpenAiCredentialDto.Builder.class) +public final class CreateOpenAiCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreateOpenAiCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "openai"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOpenAiCredentialDto && equalTo((CreateOpenAiCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOpenAiCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateOpenAiCredentialDto other); + } + + public interface _FinalStage { + CreateOpenAiCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOpenAiCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateOpenAiCredentialDto build() { + return new CreateOpenAiCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateOpenRouterCredentialDto.java b/src/main/java/com/vapi/api/types/CreateOpenRouterCredentialDto.java new file mode 100644 index 0000000..e3dbb09 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateOpenRouterCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOpenRouterCredentialDto.Builder.class) +public final class CreateOpenRouterCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreateOpenRouterCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "openrouter"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOpenRouterCredentialDto && equalTo((CreateOpenRouterCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOpenRouterCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateOpenRouterCredentialDto other); + } + + public interface _FinalStage { + CreateOpenRouterCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOpenRouterCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateOpenRouterCredentialDto build() { + return new CreateOpenRouterCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateOrgDto.java b/src/main/java/com/vapi/api/types/CreateOrgDto.java new file mode 100644 index 0000000..ce02242 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateOrgDto.java @@ -0,0 +1,251 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOrgDto.Builder.class) +public final class CreateOrgDto { + private final Optional hipaaEnabled; + + private final Optional name; + + private final Optional billingLimit; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Optional concurrencyLimit; + + private final Map additionalProperties; + + private CreateOrgDto( + Optional hipaaEnabled, + Optional name, + Optional billingLimit, + Optional serverUrl, + Optional serverUrlSecret, + Optional concurrencyLimit, + Map additionalProperties) { + this.hipaaEnabled = hipaaEnabled; + this.name = name; + this.billingLimit = billingLimit; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.concurrencyLimit = concurrencyLimit; + this.additionalProperties = additionalProperties; + } + + /** + * @return When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false. + * When HIPAA is enabled, only OpenAI/Custom LLM or Azure Providers will be available for LLM and Voice respectively. + * This is due to the compliance requirements of HIPAA. Other providers may not meet these requirements. + */ + @JsonProperty("hipaaEnabled") + public Optional getHipaaEnabled() { + return hipaaEnabled; + } + + /** + * @return This is the name of the org. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the monthly billing limit for the org. To go beyond $1000/mo, please contact us at support@vapi.ai. + */ + @JsonProperty("billingLimit") + public Optional getBillingLimit() { + return billingLimit; + } + + /** + * @return This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports. + *

All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation.

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret. + */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + /** + * @return This is the concurrency limit for the org. This is the maximum number of calls that can be active at any given time. To go beyond 10, please contact us at support@vapi.ai. + */ + @JsonProperty("concurrencyLimit") + public Optional getConcurrencyLimit() { + return concurrencyLimit; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOrgDto && equalTo((CreateOrgDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOrgDto other) { + return hipaaEnabled.equals(other.hipaaEnabled) + && name.equals(other.name) + && billingLimit.equals(other.billingLimit) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret) + && concurrencyLimit.equals(other.concurrencyLimit); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.hipaaEnabled, + this.name, + this.billingLimit, + this.serverUrl, + this.serverUrlSecret, + this.concurrencyLimit); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional hipaaEnabled = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional billingLimit = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional serverUrlSecret = Optional.empty(); + + private Optional concurrencyLimit = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateOrgDto other) { + hipaaEnabled(other.getHipaaEnabled()); + name(other.getName()); + billingLimit(other.getBillingLimit()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + concurrencyLimit(other.getConcurrencyLimit()); + return this; + } + + @JsonSetter(value = "hipaaEnabled", nulls = Nulls.SKIP) + public Builder hipaaEnabled(Optional hipaaEnabled) { + this.hipaaEnabled = hipaaEnabled; + return this; + } + + public Builder hipaaEnabled(Boolean hipaaEnabled) { + this.hipaaEnabled = Optional.ofNullable(hipaaEnabled); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "billingLimit", nulls = Nulls.SKIP) + public Builder billingLimit(Optional billingLimit) { + this.billingLimit = billingLimit; + return this; + } + + public Builder billingLimit(Double billingLimit) { + this.billingLimit = Optional.ofNullable(billingLimit); + return this; + } + + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public Builder serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + public Builder serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public Builder serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + public Builder serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @JsonSetter(value = "concurrencyLimit", nulls = Nulls.SKIP) + public Builder concurrencyLimit(Optional concurrencyLimit) { + this.concurrencyLimit = concurrencyLimit; + return this; + } + + public Builder concurrencyLimit(Double concurrencyLimit) { + this.concurrencyLimit = Optional.ofNullable(concurrencyLimit); + return this; + } + + public CreateOrgDto build() { + return new CreateOrgDto( + hipaaEnabled, + name, + billingLimit, + serverUrl, + serverUrlSecret, + concurrencyLimit, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateOutboundCallDto.java b/src/main/java/com/vapi/api/types/CreateOutboundCallDto.java new file mode 100644 index 0000000..07c06d0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateOutboundCallDto.java @@ -0,0 +1,368 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOutboundCallDto.Builder.class) +public final class CreateOutboundCallDto { + private final Optional name; + + private final Optional assistantId; + + private final Optional assistant; + + private final Optional assistantOverrides; + + private final Optional squadId; + + private final Optional squad; + + private final Optional phoneNumberId; + + private final Optional phoneNumber; + + private final Optional customerId; + + private final Optional customer; + + private final Map additionalProperties; + + private CreateOutboundCallDto( + Optional name, + Optional assistantId, + Optional assistant, + Optional assistantOverrides, + Optional squadId, + Optional squad, + Optional phoneNumberId, + Optional phoneNumber, + Optional customerId, + Optional customer, + Map additionalProperties) { + this.name = name; + this.assistantId = assistantId; + this.assistant = assistant; + this.assistantOverrides = assistantOverrides; + this.squadId = squadId; + this.squad = squad; + this.phoneNumberId = phoneNumberId; + this.phoneNumber = phoneNumber; + this.customerId = customerId; + this.customer = customer; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the name of the call. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the assistant that will be used for the call. To use a transient assistant, use assistant instead. + */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the assistant that will be used for the call. To use an existing assistant, use assistantId instead. + */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return These are the overrides for the assistant or assistantId's settings and template variables. + */ + @JsonProperty("assistantOverrides") + public Optional getAssistantOverrides() { + return assistantOverrides; + } + + /** + * @return This is the squad that will be used for the call. To use a transient squad, use squad instead. + */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is a squad that will be used for the call. To use an existing squad, use squadId instead. + */ + @JsonProperty("squad") + public Optional getSquad() { + return squad; + } + + /** + * @return This is the phone number that will be used for the call. To use a transient number, use phoneNumber instead. + *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ */ + @JsonProperty("phoneNumberId") + public Optional getPhoneNumberId() { + return phoneNumberId; + } + + /** + * @return This is the phone number that will be used for the call. To use an existing number, use phoneNumberId instead. + *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the customer that will be called. To call a transient customer , use customer instead. + *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ */ + @JsonProperty("customerId") + public Optional getCustomerId() { + return customerId; + } + + /** + * @return This is the customer that will be called. To call an existing customer, use customerId instead. + *

Only relevant for outboundPhoneCall and inboundPhoneCall type.

+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOutboundCallDto && equalTo((CreateOutboundCallDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOutboundCallDto other) { + return name.equals(other.name) + && assistantId.equals(other.assistantId) + && assistant.equals(other.assistant) + && assistantOverrides.equals(other.assistantOverrides) + && squadId.equals(other.squadId) + && squad.equals(other.squad) + && phoneNumberId.equals(other.phoneNumberId) + && phoneNumber.equals(other.phoneNumber) + && customerId.equals(other.customerId) + && customer.equals(other.customer); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.name, + this.assistantId, + this.assistant, + this.assistantOverrides, + this.squadId, + this.squad, + this.phoneNumberId, + this.phoneNumber, + this.customerId, + this.customer); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional assistantOverrides = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional squad = Optional.empty(); + + private Optional phoneNumberId = Optional.empty(); + + private Optional phoneNumber = Optional.empty(); + + private Optional customerId = Optional.empty(); + + private Optional customer = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateOutboundCallDto other) { + name(other.getName()); + assistantId(other.getAssistantId()); + assistant(other.getAssistant()); + assistantOverrides(other.getAssistantOverrides()); + squadId(other.getSquadId()); + squad(other.getSquad()); + phoneNumberId(other.getPhoneNumberId()); + phoneNumber(other.getPhoneNumber()); + customerId(other.getCustomerId()); + customer(other.getCustomer()); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public Builder assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + public Builder assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public Builder assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + public Builder assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @JsonSetter(value = "assistantOverrides", nulls = Nulls.SKIP) + public Builder assistantOverrides(Optional assistantOverrides) { + this.assistantOverrides = assistantOverrides; + return this; + } + + public Builder assistantOverrides(AssistantOverrides assistantOverrides) { + this.assistantOverrides = Optional.ofNullable(assistantOverrides); + return this; + } + + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public Builder squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + public Builder squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @JsonSetter(value = "squad", nulls = Nulls.SKIP) + public Builder squad(Optional squad) { + this.squad = squad; + return this; + } + + public Builder squad(CreateSquadDto squad) { + this.squad = Optional.ofNullable(squad); + return this; + } + + @JsonSetter(value = "phoneNumberId", nulls = Nulls.SKIP) + public Builder phoneNumberId(Optional phoneNumberId) { + this.phoneNumberId = phoneNumberId; + return this; + } + + public Builder phoneNumberId(String phoneNumberId) { + this.phoneNumberId = Optional.ofNullable(phoneNumberId); + return this; + } + + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public Builder phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + public Builder phoneNumber(ImportTwilioPhoneNumberDto phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @JsonSetter(value = "customerId", nulls = Nulls.SKIP) + public Builder customerId(Optional customerId) { + this.customerId = customerId; + return this; + } + + public Builder customerId(String customerId) { + this.customerId = Optional.ofNullable(customerId); + return this; + } + + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public Builder customer(Optional customer) { + this.customer = customer; + return this; + } + + public Builder customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + public CreateOutboundCallDto build() { + return new CreateOutboundCallDto( + name, + assistantId, + assistant, + assistantOverrides, + squadId, + squad, + phoneNumberId, + phoneNumber, + customerId, + customer, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateOutputToolDto.java b/src/main/java/com/vapi/api/types/CreateOutputToolDto.java new file mode 100644 index 0000000..2a3b166 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateOutputToolDto.java @@ -0,0 +1,190 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOutputToolDto.Builder.class) +public final class CreateOutputToolDto { + private final Optional async; + + private final Optional> messages; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private CreateOutputToolDto( + Optional async, + Optional> messages, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOutputToolDto && equalTo((CreateOutputToolDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOutputToolDto other) { + return async.equals(other.async) + && messages.equals(other.messages) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.async, this.messages, this.function, this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional async = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional server = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateOutputToolDto other) { + async(other.getAsync()); + messages(other.getMessages()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public Builder async(Optional async) { + this.async = async; + return this; + } + + public Builder async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public Builder function(Optional function) { + this.function = function; + return this; + } + + public Builder function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public Builder server(Optional server) { + this.server = server; + return this; + } + + public Builder server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + public CreateOutputToolDto build() { + return new CreateOutputToolDto(async, messages, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateOutputToolDtoMessagesItem.java b/src/main/java/com/vapi/api/types/CreateOutputToolDtoMessagesItem.java new file mode 100644 index 0000000..278ded0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateOutputToolDtoMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateOutputToolDtoMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateOutputToolDtoMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateOutputToolDtoMessagesItem requestStart(ToolMessageStart value) { + return new CreateOutputToolDtoMessagesItem(new RequestStartValue(value)); + } + + public static CreateOutputToolDtoMessagesItem requestComplete(ToolMessageComplete value) { + return new CreateOutputToolDtoMessagesItem(new RequestCompleteValue(value)); + } + + public static CreateOutputToolDtoMessagesItem requestFailed(ToolMessageFailed value) { + return new CreateOutputToolDtoMessagesItem(new RequestFailedValue(value)); + } + + public static CreateOutputToolDtoMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new CreateOutputToolDtoMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateOutputToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateOutputToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateOutputToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateOutputToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateOutputToolDtoMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreatePerplexityAiCredentialDto.java b/src/main/java/com/vapi/api/types/CreatePerplexityAiCredentialDto.java new file mode 100644 index 0000000..00b3e3c --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreatePerplexityAiCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePerplexityAiCredentialDto.Builder.class) +public final class CreatePerplexityAiCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreatePerplexityAiCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "perplexity-ai"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePerplexityAiCredentialDto && equalTo((CreatePerplexityAiCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePerplexityAiCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreatePerplexityAiCredentialDto other); + } + + public interface _FinalStage { + CreatePerplexityAiCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePerplexityAiCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreatePerplexityAiCredentialDto build() { + return new CreatePerplexityAiCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreatePlayHtCredentialDto.java b/src/main/java/com/vapi/api/types/CreatePlayHtCredentialDto.java new file mode 100644 index 0000000..c3c3453 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreatePlayHtCredentialDto.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreatePlayHtCredentialDto.Builder.class) +public final class CreatePlayHtCredentialDto { + private final String apiKey; + + private final String userId; + + private final Map additionalProperties; + + private CreatePlayHtCredentialDto(String apiKey, String userId, Map additionalProperties) { + this.apiKey = apiKey; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "playht"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @JsonProperty("userId") + public String getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreatePlayHtCredentialDto && equalTo((CreatePlayHtCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreatePlayHtCredentialDto other) { + return apiKey.equals(other.apiKey) && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + UserIdStage apiKey(@NotNull String apiKey); + + Builder from(CreatePlayHtCredentialDto other); + } + + public interface UserIdStage { + _FinalStage userId(@NotNull String userId); + } + + public interface _FinalStage { + CreatePlayHtCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, UserIdStage, _FinalStage { + private String apiKey; + + private String userId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreatePlayHtCredentialDto other) { + apiKey(other.getApiKey()); + userId(other.getUserId()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public UserIdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("userId") + public _FinalStage userId(@NotNull String userId) { + this.userId = Objects.requireNonNull(userId, "userId must not be null"); + return this; + } + + @java.lang.Override + public CreatePlayHtCredentialDto build() { + return new CreatePlayHtCredentialDto(apiKey, userId, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateRimeAiCredentialDto.java b/src/main/java/com/vapi/api/types/CreateRimeAiCredentialDto.java new file mode 100644 index 0000000..f8baea8 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateRimeAiCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateRimeAiCredentialDto.Builder.class) +public final class CreateRimeAiCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreateRimeAiCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "rime-ai"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateRimeAiCredentialDto && equalTo((CreateRimeAiCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateRimeAiCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateRimeAiCredentialDto other); + } + + public interface _FinalStage { + CreateRimeAiCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateRimeAiCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateRimeAiCredentialDto build() { + return new CreateRimeAiCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateRunpodCredentialDto.java b/src/main/java/com/vapi/api/types/CreateRunpodCredentialDto.java new file mode 100644 index 0000000..d76314e --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateRunpodCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateRunpodCredentialDto.Builder.class) +public final class CreateRunpodCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreateRunpodCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "runpod"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateRunpodCredentialDto && equalTo((CreateRunpodCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateRunpodCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateRunpodCredentialDto other); + } + + public interface _FinalStage { + CreateRunpodCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateRunpodCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateRunpodCredentialDto build() { + return new CreateRunpodCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateS3CredentialDto.java b/src/main/java/com/vapi/api/types/CreateS3CredentialDto.java new file mode 100644 index 0000000..b527baa --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateS3CredentialDto.java @@ -0,0 +1,251 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateS3CredentialDto.Builder.class) +public final class CreateS3CredentialDto { + private final String awsAccessKeyId; + + private final String awsSecretAccessKey; + + private final String region; + + private final String s3BucketName; + + private final String s3PathPrefix; + + private final Map additionalProperties; + + private CreateS3CredentialDto( + String awsAccessKeyId, + String awsSecretAccessKey, + String region, + String s3BucketName, + String s3PathPrefix, + Map additionalProperties) { + this.awsAccessKeyId = awsAccessKeyId; + this.awsSecretAccessKey = awsSecretAccessKey; + this.region = region; + this.s3BucketName = s3BucketName; + this.s3PathPrefix = s3PathPrefix; + this.additionalProperties = additionalProperties; + } + + /** + * @return Credential provider. Only allowed value is s3 + */ + @JsonProperty("provider") + public String getProvider() { + return "s3"; + } + + /** + * @return AWS access key ID. + */ + @JsonProperty("awsAccessKeyId") + public String getAwsAccessKeyId() { + return awsAccessKeyId; + } + + /** + * @return AWS access key secret. This is not returned in the API. + */ + @JsonProperty("awsSecretAccessKey") + public String getAwsSecretAccessKey() { + return awsSecretAccessKey; + } + + /** + * @return AWS region in which the S3 bucket is located. + */ + @JsonProperty("region") + public String getRegion() { + return region; + } + + /** + * @return AWS S3 bucket name. + */ + @JsonProperty("s3BucketName") + public String getS3BucketName() { + return s3BucketName; + } + + /** + * @return The path prefix for the uploaded recording. Ex. "recordings/" + */ + @JsonProperty("s3PathPrefix") + public String getS3PathPrefix() { + return s3PathPrefix; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateS3CredentialDto && equalTo((CreateS3CredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateS3CredentialDto other) { + return awsAccessKeyId.equals(other.awsAccessKeyId) + && awsSecretAccessKey.equals(other.awsSecretAccessKey) + && region.equals(other.region) + && s3BucketName.equals(other.s3BucketName) + && s3PathPrefix.equals(other.s3PathPrefix); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.awsAccessKeyId, this.awsSecretAccessKey, this.region, this.s3BucketName, this.s3PathPrefix); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AwsAccessKeyIdStage builder() { + return new Builder(); + } + + public interface AwsAccessKeyIdStage { + AwsSecretAccessKeyStage awsAccessKeyId(@NotNull String awsAccessKeyId); + + Builder from(CreateS3CredentialDto other); + } + + public interface AwsSecretAccessKeyStage { + RegionStage awsSecretAccessKey(@NotNull String awsSecretAccessKey); + } + + public interface RegionStage { + S3BucketNameStage region(@NotNull String region); + } + + public interface S3BucketNameStage { + S3PathPrefixStage s3BucketName(@NotNull String s3BucketName); + } + + public interface S3PathPrefixStage { + _FinalStage s3PathPrefix(@NotNull String s3PathPrefix); + } + + public interface _FinalStage { + CreateS3CredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AwsAccessKeyIdStage, + AwsSecretAccessKeyStage, + RegionStage, + S3BucketNameStage, + S3PathPrefixStage, + _FinalStage { + private String awsAccessKeyId; + + private String awsSecretAccessKey; + + private String region; + + private String s3BucketName; + + private String s3PathPrefix; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateS3CredentialDto other) { + awsAccessKeyId(other.getAwsAccessKeyId()); + awsSecretAccessKey(other.getAwsSecretAccessKey()); + region(other.getRegion()); + s3BucketName(other.getS3BucketName()); + s3PathPrefix(other.getS3PathPrefix()); + return this; + } + + /** + *

AWS access key ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("awsAccessKeyId") + public AwsSecretAccessKeyStage awsAccessKeyId(@NotNull String awsAccessKeyId) { + this.awsAccessKeyId = Objects.requireNonNull(awsAccessKeyId, "awsAccessKeyId must not be null"); + return this; + } + + /** + *

AWS access key secret. This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("awsSecretAccessKey") + public RegionStage awsSecretAccessKey(@NotNull String awsSecretAccessKey) { + this.awsSecretAccessKey = Objects.requireNonNull(awsSecretAccessKey, "awsSecretAccessKey must not be null"); + return this; + } + + /** + *

AWS region in which the S3 bucket is located.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("region") + public S3BucketNameStage region(@NotNull String region) { + this.region = Objects.requireNonNull(region, "region must not be null"); + return this; + } + + /** + *

AWS S3 bucket name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("s3BucketName") + public S3PathPrefixStage s3BucketName(@NotNull String s3BucketName) { + this.s3BucketName = Objects.requireNonNull(s3BucketName, "s3BucketName must not be null"); + return this; + } + + /** + *

The path prefix for the uploaded recording. Ex. "recordings/"

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("s3PathPrefix") + public _FinalStage s3PathPrefix(@NotNull String s3PathPrefix) { + this.s3PathPrefix = Objects.requireNonNull(s3PathPrefix, "s3PathPrefix must not be null"); + return this; + } + + @java.lang.Override + public CreateS3CredentialDto build() { + return new CreateS3CredentialDto( + awsAccessKeyId, awsSecretAccessKey, region, s3BucketName, s3PathPrefix, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateSquadDto.java b/src/main/java/com/vapi/api/types/CreateSquadDto.java new file mode 100644 index 0000000..1e84299 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateSquadDto.java @@ -0,0 +1,164 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateSquadDto.Builder.class) +public final class CreateSquadDto { + private final Optional name; + + private final List members; + + private final Optional membersOverrides; + + private final Map additionalProperties; + + private CreateSquadDto( + Optional name, + List members, + Optional membersOverrides, + Map additionalProperties) { + this.name = name; + this.members = members; + this.membersOverrides = membersOverrides; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the name of the squad. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the list of assistants that make up the squad. + *

The call will start with the first assistant in the list.

+ */ + @JsonProperty("members") + public List getMembers() { + return members; + } + + /** + * @return This can be used to override all the assistants' settings and provide values for their template variables. + *

Both membersOverrides and members[n].assistantOverrides can be used together. First, members[n].assistantOverrides is applied. Then, membersOverrides is applied as a global override.

+ */ + @JsonProperty("membersOverrides") + public Optional getMembersOverrides() { + return membersOverrides; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateSquadDto && equalTo((CreateSquadDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateSquadDto other) { + return name.equals(other.name) + && members.equals(other.members) + && membersOverrides.equals(other.membersOverrides); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.members, this.membersOverrides); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private List members = new ArrayList<>(); + + private Optional membersOverrides = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateSquadDto other) { + name(other.getName()); + members(other.getMembers()); + membersOverrides(other.getMembersOverrides()); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "members", nulls = Nulls.SKIP) + public Builder members(List members) { + this.members.clear(); + this.members.addAll(members); + return this; + } + + public Builder addMembers(SquadMemberDto members) { + this.members.add(members); + return this; + } + + public Builder addAllMembers(List members) { + this.members.addAll(members); + return this; + } + + @JsonSetter(value = "membersOverrides", nulls = Nulls.SKIP) + public Builder membersOverrides(Optional membersOverrides) { + this.membersOverrides = membersOverrides; + return this; + } + + public Builder membersOverrides(AssistantOverrides membersOverrides) { + this.membersOverrides = Optional.ofNullable(membersOverrides); + return this; + } + + public CreateSquadDto build() { + return new CreateSquadDto(name, members, membersOverrides, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateTogetherAiCredentialDto.java b/src/main/java/com/vapi/api/types/CreateTogetherAiCredentialDto.java new file mode 100644 index 0000000..e4c4805 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateTogetherAiCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTogetherAiCredentialDto.Builder.class) +public final class CreateTogetherAiCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private CreateTogetherAiCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "together-ai"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTogetherAiCredentialDto && equalTo((CreateTogetherAiCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTogetherAiCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(CreateTogetherAiCredentialDto other); + } + + public interface _FinalStage { + CreateTogetherAiCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTogetherAiCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateTogetherAiCredentialDto build() { + return new CreateTogetherAiCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateTokenDto.java b/src/main/java/com/vapi/api/types/CreateTokenDto.java new file mode 100644 index 0000000..d12cd4b --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateTokenDto.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTokenDto.Builder.class) +public final class CreateTokenDto { + private final Optional tag; + + private final Optional name; + + private final Optional restrictions; + + private final Map additionalProperties; + + private CreateTokenDto( + Optional tag, + Optional name, + Optional restrictions, + Map additionalProperties) { + this.tag = tag; + this.name = name; + this.restrictions = restrictions; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the tag for the token. It represents its scope. + */ + @JsonProperty("tag") + public Optional getTag() { + return tag; + } + + /** + * @return This is the name of the token. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This are the restrictions for the token. + */ + @JsonProperty("restrictions") + public Optional getRestrictions() { + return restrictions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTokenDto && equalTo((CreateTokenDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTokenDto other) { + return tag.equals(other.tag) && name.equals(other.name) && restrictions.equals(other.restrictions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.tag, this.name, this.restrictions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional tag = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional restrictions = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateTokenDto other) { + tag(other.getTag()); + name(other.getName()); + restrictions(other.getRestrictions()); + return this; + } + + @JsonSetter(value = "tag", nulls = Nulls.SKIP) + public Builder tag(Optional tag) { + this.tag = tag; + return this; + } + + public Builder tag(CreateTokenDtoTag tag) { + this.tag = Optional.ofNullable(tag); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "restrictions", nulls = Nulls.SKIP) + public Builder restrictions(Optional restrictions) { + this.restrictions = restrictions; + return this; + } + + public Builder restrictions(TokenRestrictions restrictions) { + this.restrictions = Optional.ofNullable(restrictions); + return this; + } + + public CreateTokenDto build() { + return new CreateTokenDto(tag, name, restrictions, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateTokenDtoTag.java b/src/main/java/com/vapi/api/types/CreateTokenDtoTag.java new file mode 100644 index 0000000..c433a90 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateTokenDtoTag.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CreateTokenDtoTag { + PRIVATE("private"), + + PUBLIC("public"); + + private final String value; + + CreateTokenDtoTag(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CreateToolCallBlockDto.java b/src/main/java/com/vapi/api/types/CreateToolCallBlockDto.java new file mode 100644 index 0000000..f1b55f9 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateToolCallBlockDto.java @@ -0,0 +1,253 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateToolCallBlockDto.Builder.class) +public final class CreateToolCallBlockDto { + private final Optional> messages; + + private final Optional inputSchema; + + private final Optional outputSchema; + + private final Optional tool; + + private final Optional toolId; + + private final Optional name; + + private final Map additionalProperties; + + private CreateToolCallBlockDto( + Optional> messages, + Optional inputSchema, + Optional outputSchema, + Optional tool, + Optional toolId, + Optional name, + Map additionalProperties) { + this.messages = messages; + this.inputSchema = inputSchema; + this.outputSchema = outputSchema; + this.tool = tool; + this.toolId = toolId; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the pre-configured messages that will be spoken to the user while the block is running. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the input schema for the block. This is the input the block needs to run. It's given to the block as steps[0].input + *

These are accessible as variables:

+ *
    + *
  • ({{input.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.input.propertyName}}) in context of the workflow
  • + *
+ */ + @JsonProperty("inputSchema") + public Optional getInputSchema() { + return inputSchema; + } + + /** + * @return This is the output schema for the block. This is the output the block will return to the workflow ({{stepName.output}}). + *

These are accessible as variables:

+ *
    + *
  • ({{output.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
  • + *
  • ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2)
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ */ + @JsonProperty("outputSchema") + public Optional getOutputSchema() { + return outputSchema; + } + + /** + * @return This is the tool that the block will call. To use an existing tool, use toolId. + */ + @JsonProperty("tool") + public Optional getTool() { + return tool; + } + + /** + * @return This is the id of the tool that the block will call. To use a transient tool, use tool. + */ + @JsonProperty("toolId") + public Optional getToolId() { + return toolId; + } + + /** + * @return This is the name of the block. This is just for your reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateToolCallBlockDto && equalTo((CreateToolCallBlockDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateToolCallBlockDto other) { + return messages.equals(other.messages) + && inputSchema.equals(other.inputSchema) + && outputSchema.equals(other.outputSchema) + && tool.equals(other.tool) + && toolId.equals(other.toolId) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.messages, this.inputSchema, this.outputSchema, this.tool, this.toolId, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> messages = Optional.empty(); + + private Optional inputSchema = Optional.empty(); + + private Optional outputSchema = Optional.empty(); + + private Optional tool = Optional.empty(); + + private Optional toolId = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateToolCallBlockDto other) { + messages(other.getMessages()); + inputSchema(other.getInputSchema()); + outputSchema(other.getOutputSchema()); + tool(other.getTool()); + toolId(other.getToolId()); + name(other.getName()); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "inputSchema", nulls = Nulls.SKIP) + public Builder inputSchema(Optional inputSchema) { + this.inputSchema = inputSchema; + return this; + } + + public Builder inputSchema(JsonSchema inputSchema) { + this.inputSchema = Optional.ofNullable(inputSchema); + return this; + } + + @JsonSetter(value = "outputSchema", nulls = Nulls.SKIP) + public Builder outputSchema(Optional outputSchema) { + this.outputSchema = outputSchema; + return this; + } + + public Builder outputSchema(JsonSchema outputSchema) { + this.outputSchema = Optional.ofNullable(outputSchema); + return this; + } + + @JsonSetter(value = "tool", nulls = Nulls.SKIP) + public Builder tool(Optional tool) { + this.tool = tool; + return this; + } + + public Builder tool(CreateToolCallBlockDtoTool tool) { + this.tool = Optional.ofNullable(tool); + return this; + } + + @JsonSetter(value = "toolId", nulls = Nulls.SKIP) + public Builder toolId(Optional toolId) { + this.toolId = toolId; + return this; + } + + public Builder toolId(String toolId) { + this.toolId = Optional.ofNullable(toolId); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public CreateToolCallBlockDto build() { + return new CreateToolCallBlockDto( + messages, inputSchema, outputSchema, tool, toolId, name, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateToolCallBlockDtoMessagesItem.java b/src/main/java/com/vapi/api/types/CreateToolCallBlockDtoMessagesItem.java new file mode 100644 index 0000000..d2abbbd --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateToolCallBlockDtoMessagesItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateToolCallBlockDtoMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateToolCallBlockDtoMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateToolCallBlockDtoMessagesItem blockStart(BlockStartMessage value) { + return new CreateToolCallBlockDtoMessagesItem(new BlockStartValue(value)); + } + + public static CreateToolCallBlockDtoMessagesItem blockComplete(BlockCompleteMessage value) { + return new CreateToolCallBlockDtoMessagesItem(new BlockCompleteValue(value)); + } + + public boolean isBlockStart() { + return value instanceof BlockStartValue; + } + + public boolean isBlockComplete() { + return value instanceof BlockCompleteValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getBlockStart() { + if (isBlockStart()) { + return Optional.of(((BlockStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getBlockComplete() { + if (isBlockComplete()) { + return Optional.of(((BlockCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitBlockStart(BlockStartMessage blockStart); + + T visitBlockComplete(BlockCompleteMessage blockComplete); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(BlockStartValue.class), @JsonSubTypes.Type(BlockCompleteValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("block-start") + private static final class BlockStartValue implements Value { + @JsonUnwrapped + private BlockStartMessage value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BlockStartValue() {} + + private BlockStartValue(BlockStartMessage value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBlockStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockStartValue && equalTo((BlockStartValue) other); + } + + private boolean equalTo(BlockStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolCallBlockDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("block-complete") + private static final class BlockCompleteValue implements Value { + @JsonUnwrapped + private BlockCompleteMessage value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BlockCompleteValue() {} + + private BlockCompleteValue(BlockCompleteMessage value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBlockComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockCompleteValue && equalTo((BlockCompleteValue) other); + } + + private boolean equalTo(BlockCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolCallBlockDtoMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolCallBlockDtoMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateToolCallBlockDtoTool.java b/src/main/java/com/vapi/api/types/CreateToolCallBlockDtoTool.java new file mode 100644 index 0000000..da0a044 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateToolCallBlockDtoTool.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateToolCallBlockDtoTool { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateToolCallBlockDtoTool(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateToolCallBlockDtoTool dtmf(CreateDtmfToolDto value) { + return new CreateToolCallBlockDtoTool(new DtmfValue(value)); + } + + public static CreateToolCallBlockDtoTool endCall(CreateEndCallToolDto value) { + return new CreateToolCallBlockDtoTool(new EndCallValue(value)); + } + + public static CreateToolCallBlockDtoTool voicemail(CreateVoicemailToolDto value) { + return new CreateToolCallBlockDtoTool(new VoicemailValue(value)); + } + + public static CreateToolCallBlockDtoTool function(CreateFunctionToolDto value) { + return new CreateToolCallBlockDtoTool(new FunctionValue(value)); + } + + public static CreateToolCallBlockDtoTool ghl(CreateGhlToolDto value) { + return new CreateToolCallBlockDtoTool(new GhlValue(value)); + } + + public static CreateToolCallBlockDtoTool make(CreateMakeToolDto value) { + return new CreateToolCallBlockDtoTool(new MakeValue(value)); + } + + public static CreateToolCallBlockDtoTool transferCall(CreateTransferCallToolDto value) { + return new CreateToolCallBlockDtoTool(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolCallBlockDtoTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolCallBlockDtoTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolCallBlockDtoTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolCallBlockDtoTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolCallBlockDtoTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolCallBlockDtoTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolCallBlockDtoTool{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolCallBlockDtoTool{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateToolTemplateDto.java b/src/main/java/com/vapi/api/types/CreateToolTemplateDto.java new file mode 100644 index 0000000..f42b9ed --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateToolTemplateDto.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateToolTemplateDto.Builder.class) +public final class CreateToolTemplateDto { + private final Optional details; + + private final Optional providerDetails; + + private final Optional metadata; + + private final Optional visibility; + + private final Optional name; + + private final Optional provider; + + private final Map additionalProperties; + + private CreateToolTemplateDto( + Optional details, + Optional providerDetails, + Optional metadata, + Optional visibility, + Optional name, + Optional provider, + Map additionalProperties) { + this.details = details; + this.providerDetails = providerDetails; + this.metadata = metadata; + this.visibility = visibility; + this.name = name; + this.provider = provider; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("details") + public Optional getDetails() { + return details; + } + + @JsonProperty("providerDetails") + public Optional getProviderDetails() { + return providerDetails; + } + + @JsonProperty("metadata") + public Optional getMetadata() { + return metadata; + } + + @JsonProperty("visibility") + public Optional getVisibility() { + return visibility; + } + + @JsonProperty("type") + public String getType() { + return "tool"; + } + + /** + * @return The name of the template. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("provider") + public Optional getProvider() { + return provider; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateToolTemplateDto && equalTo((CreateToolTemplateDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateToolTemplateDto other) { + return details.equals(other.details) + && providerDetails.equals(other.providerDetails) + && metadata.equals(other.metadata) + && visibility.equals(other.visibility) + && name.equals(other.name) + && provider.equals(other.provider); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.details, this.providerDetails, this.metadata, this.visibility, this.name, this.provider); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional details = Optional.empty(); + + private Optional providerDetails = Optional.empty(); + + private Optional metadata = Optional.empty(); + + private Optional visibility = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional provider = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateToolTemplateDto other) { + details(other.getDetails()); + providerDetails(other.getProviderDetails()); + metadata(other.getMetadata()); + visibility(other.getVisibility()); + name(other.getName()); + provider(other.getProvider()); + return this; + } + + @JsonSetter(value = "details", nulls = Nulls.SKIP) + public Builder details(Optional details) { + this.details = details; + return this; + } + + public Builder details(CreateToolTemplateDtoDetails details) { + this.details = Optional.ofNullable(details); + return this; + } + + @JsonSetter(value = "providerDetails", nulls = Nulls.SKIP) + public Builder providerDetails(Optional providerDetails) { + this.providerDetails = providerDetails; + return this; + } + + public Builder providerDetails(CreateToolTemplateDtoProviderDetails providerDetails) { + this.providerDetails = Optional.ofNullable(providerDetails); + return this; + } + + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(ToolTemplateMetadata metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public Builder visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + public Builder visibility(CreateToolTemplateDtoVisibility visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "provider", nulls = Nulls.SKIP) + public Builder provider(Optional provider) { + this.provider = provider; + return this; + } + + public Builder provider(CreateToolTemplateDtoProvider provider) { + this.provider = Optional.ofNullable(provider); + return this; + } + + public CreateToolTemplateDto build() { + return new CreateToolTemplateDto( + details, providerDetails, metadata, visibility, name, provider, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateToolTemplateDtoDetails.java b/src/main/java/com/vapi/api/types/CreateToolTemplateDtoDetails.java new file mode 100644 index 0000000..3ca0af7 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateToolTemplateDtoDetails.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateToolTemplateDtoDetails { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateToolTemplateDtoDetails(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateToolTemplateDtoDetails dtmf(CreateDtmfToolDto value) { + return new CreateToolTemplateDtoDetails(new DtmfValue(value)); + } + + public static CreateToolTemplateDtoDetails endCall(CreateEndCallToolDto value) { + return new CreateToolTemplateDtoDetails(new EndCallValue(value)); + } + + public static CreateToolTemplateDtoDetails voicemail(CreateVoicemailToolDto value) { + return new CreateToolTemplateDtoDetails(new VoicemailValue(value)); + } + + public static CreateToolTemplateDtoDetails function(CreateFunctionToolDto value) { + return new CreateToolTemplateDtoDetails(new FunctionValue(value)); + } + + public static CreateToolTemplateDtoDetails ghl(CreateGhlToolDto value) { + return new CreateToolTemplateDtoDetails(new GhlValue(value)); + } + + public static CreateToolTemplateDtoDetails make(CreateMakeToolDto value) { + return new CreateToolTemplateDtoDetails(new MakeValue(value)); + } + + public static CreateToolTemplateDtoDetails transferCall(CreateTransferCallToolDto value) { + return new CreateToolTemplateDtoDetails(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolTemplateDtoDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolTemplateDtoDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolTemplateDtoDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolTemplateDtoDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolTemplateDtoDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolTemplateDtoDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolTemplateDtoDetails{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolTemplateDtoDetails{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateToolTemplateDtoProvider.java b/src/main/java/com/vapi/api/types/CreateToolTemplateDtoProvider.java new file mode 100644 index 0000000..8b9a574 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateToolTemplateDtoProvider.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CreateToolTemplateDtoProvider { + MAKE("make"), + + GOHIGHLEVEL("gohighlevel"), + + FUNCTION("function"); + + private final String value; + + CreateToolTemplateDtoProvider(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CreateToolTemplateDtoProviderDetails.java b/src/main/java/com/vapi/api/types/CreateToolTemplateDtoProviderDetails.java new file mode 100644 index 0000000..c0cce5e --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateToolTemplateDtoProviderDetails.java @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateToolTemplateDtoProviderDetails { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateToolTemplateDtoProviderDetails(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateToolTemplateDtoProviderDetails make(MakeToolProviderDetails value) { + return new CreateToolTemplateDtoProviderDetails(new MakeValue(value)); + } + + public static CreateToolTemplateDtoProviderDetails ghl(GhlToolProviderDetails value) { + return new CreateToolTemplateDtoProviderDetails(new GhlValue(value)); + } + + public static CreateToolTemplateDtoProviderDetails function(FunctionToolProviderDetails value) { + return new CreateToolTemplateDtoProviderDetails(new FunctionValue(value)); + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitMake(MakeToolProviderDetails make); + + T visitGhl(GhlToolProviderDetails ghl); + + T visitFunction(FunctionToolProviderDetails function); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(FunctionValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private MakeToolProviderDetails value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(MakeToolProviderDetails value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolTemplateDtoProviderDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private GhlToolProviderDetails value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(GhlToolProviderDetails value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolTemplateDtoProviderDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private FunctionToolProviderDetails value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(FunctionToolProviderDetails value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolTemplateDtoProviderDetails{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateToolTemplateDtoProviderDetails{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateToolTemplateDtoVisibility.java b/src/main/java/com/vapi/api/types/CreateToolTemplateDtoVisibility.java new file mode 100644 index 0000000..46079e5 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateToolTemplateDtoVisibility.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CreateToolTemplateDtoVisibility { + PUBLIC("public"), + + PRIVATE("private"); + + private final String value; + + CreateToolTemplateDtoVisibility(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CreateTransferCallToolDto.java b/src/main/java/com/vapi/api/types/CreateTransferCallToolDto.java new file mode 100644 index 0000000..81da4f9 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateTransferCallToolDto.java @@ -0,0 +1,217 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTransferCallToolDto.Builder.class) +public final class CreateTransferCallToolDto { + private final Optional async; + + private final Optional> messages; + + private final Optional> destinations; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private CreateTransferCallToolDto( + Optional async, + Optional> messages, + Optional> destinations, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.destinations = destinations; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return These are the destinations that the call can be transferred to. If no destinations are provided, server.url will be used to get the transfer destination once the tool is called. + */ + @JsonProperty("destinations") + public Optional> getDestinations() { + return destinations; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTransferCallToolDto && equalTo((CreateTransferCallToolDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTransferCallToolDto other) { + return async.equals(other.async) + && messages.equals(other.messages) + && destinations.equals(other.destinations) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.async, this.messages, this.destinations, this.function, this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional async = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional> destinations = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional server = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateTransferCallToolDto other) { + async(other.getAsync()); + messages(other.getMessages()); + destinations(other.getDestinations()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public Builder async(Optional async) { + this.async = async; + return this; + } + + public Builder async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "destinations", nulls = Nulls.SKIP) + public Builder destinations(Optional> destinations) { + this.destinations = destinations; + return this; + } + + public Builder destinations(List destinations) { + this.destinations = Optional.ofNullable(destinations); + return this; + } + + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public Builder function(Optional function) { + this.function = function; + return this; + } + + public Builder function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public Builder server(Optional server) { + this.server = server; + return this; + } + + public Builder server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + public CreateTransferCallToolDto build() { + return new CreateTransferCallToolDto(async, messages, destinations, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateTransferCallToolDtoDestinationsItem.java b/src/main/java/com/vapi/api/types/CreateTransferCallToolDtoDestinationsItem.java new file mode 100644 index 0000000..969a25f --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateTransferCallToolDtoDestinationsItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateTransferCallToolDtoDestinationsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateTransferCallToolDtoDestinationsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateTransferCallToolDtoDestinationsItem assistant(TransferDestinationAssistant value) { + return new CreateTransferCallToolDtoDestinationsItem(new AssistantValue(value)); + } + + public static CreateTransferCallToolDtoDestinationsItem step(TransferDestinationStep value) { + return new CreateTransferCallToolDtoDestinationsItem(new StepValue(value)); + } + + public static CreateTransferCallToolDtoDestinationsItem number(TransferDestinationNumber value) { + return new CreateTransferCallToolDtoDestinationsItem(new NumberValue(value)); + } + + public static CreateTransferCallToolDtoDestinationsItem sip(TransferDestinationSip value) { + return new CreateTransferCallToolDtoDestinationsItem(new SipValue(value)); + } + + public boolean isAssistant() { + return value instanceof AssistantValue; + } + + public boolean isStep() { + return value instanceof StepValue; + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAssistant() { + if (isAssistant()) { + return Optional.of(((AssistantValue) value).value); + } + return Optional.empty(); + } + + public Optional getStep() { + if (isStep()) { + return Optional.of(((StepValue) value).value); + } + return Optional.empty(); + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAssistant(TransferDestinationAssistant assistant); + + T visitStep(TransferDestinationStep step); + + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AssistantValue.class), + @JsonSubTypes.Type(StepValue.class), + @JsonSubTypes.Type(NumberValue.class), + @JsonSubTypes.Type(SipValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("assistant") + private static final class AssistantValue implements Value { + @JsonUnwrapped + private TransferDestinationAssistant value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AssistantValue() {} + + private AssistantValue(TransferDestinationAssistant value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAssistant(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AssistantValue && equalTo((AssistantValue) other); + } + + private boolean equalTo(AssistantValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransferCallToolDtoDestinationsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("step") + private static final class StepValue implements Value { + @JsonUnwrapped + private TransferDestinationStep value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private StepValue() {} + + private StepValue(TransferDestinationStep value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitStep(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StepValue && equalTo((StepValue) other); + } + + private boolean equalTo(StepValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransferCallToolDtoDestinationsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransferCallToolDtoDestinationsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransferCallToolDtoDestinationsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransferCallToolDtoDestinationsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateTransferCallToolDtoMessagesItem.java b/src/main/java/com/vapi/api/types/CreateTransferCallToolDtoMessagesItem.java new file mode 100644 index 0000000..bb98a4f --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateTransferCallToolDtoMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateTransferCallToolDtoMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateTransferCallToolDtoMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateTransferCallToolDtoMessagesItem requestStart(ToolMessageStart value) { + return new CreateTransferCallToolDtoMessagesItem(new RequestStartValue(value)); + } + + public static CreateTransferCallToolDtoMessagesItem requestComplete(ToolMessageComplete value) { + return new CreateTransferCallToolDtoMessagesItem(new RequestCompleteValue(value)); + } + + public static CreateTransferCallToolDtoMessagesItem requestFailed(ToolMessageFailed value) { + return new CreateTransferCallToolDtoMessagesItem(new RequestFailedValue(value)); + } + + public static CreateTransferCallToolDtoMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new CreateTransferCallToolDtoMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransferCallToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransferCallToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransferCallToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransferCallToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTransferCallToolDtoMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateTwilioCredentialDto.java b/src/main/java/com/vapi/api/types/CreateTwilioCredentialDto.java new file mode 100644 index 0000000..8b70a97 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateTwilioCredentialDto.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTwilioCredentialDto.Builder.class) +public final class CreateTwilioCredentialDto { + private final String authToken; + + private final String accountSid; + + private final Map additionalProperties; + + private CreateTwilioCredentialDto(String authToken, String accountSid, Map additionalProperties) { + this.authToken = authToken; + this.accountSid = accountSid; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "twilio"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("authToken") + public String getAuthToken() { + return authToken; + } + + @JsonProperty("accountSid") + public String getAccountSid() { + return accountSid; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTwilioCredentialDto && equalTo((CreateTwilioCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTwilioCredentialDto other) { + return authToken.equals(other.authToken) && accountSid.equals(other.accountSid); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.authToken, this.accountSid); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AuthTokenStage builder() { + return new Builder(); + } + + public interface AuthTokenStage { + AccountSidStage authToken(@NotNull String authToken); + + Builder from(CreateTwilioCredentialDto other); + } + + public interface AccountSidStage { + _FinalStage accountSid(@NotNull String accountSid); + } + + public interface _FinalStage { + CreateTwilioCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AuthTokenStage, AccountSidStage, _FinalStage { + private String authToken; + + private String accountSid; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTwilioCredentialDto other) { + authToken(other.getAuthToken()); + accountSid(other.getAccountSid()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("authToken") + public AccountSidStage authToken(@NotNull String authToken) { + this.authToken = Objects.requireNonNull(authToken, "authToken must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("accountSid") + public _FinalStage accountSid(@NotNull String accountSid) { + this.accountSid = Objects.requireNonNull(accountSid, "accountSid must not be null"); + return this; + } + + @java.lang.Override + public CreateTwilioCredentialDto build() { + return new CreateTwilioCredentialDto(authToken, accountSid, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateTwilioPhoneNumberDto.java b/src/main/java/com/vapi/api/types/CreateTwilioPhoneNumberDto.java new file mode 100644 index 0000000..97712a4 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateTwilioPhoneNumberDto.java @@ -0,0 +1,439 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTwilioPhoneNumberDto.Builder.class) +public final class CreateTwilioPhoneNumberDto { + private final Optional fallbackDestination; + + private final String number; + + private final String twilioAccountSid; + + private final String twilioAuthToken; + + private final Optional name; + + private final Optional assistantId; + + private final Optional squadId; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Map additionalProperties; + + private CreateTwilioPhoneNumberDto( + Optional fallbackDestination, + String number, + String twilioAccountSid, + String twilioAuthToken, + Optional name, + Optional assistantId, + Optional squadId, + Optional serverUrl, + Optional serverUrlSecret, + Map additionalProperties) { + this.fallbackDestination = fallbackDestination; + this.number = number; + this.twilioAccountSid = twilioAccountSid; + this.twilioAuthToken = twilioAuthToken; + this.name = name; + this.assistantId = assistantId; + this.squadId = squadId; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the fallback destination an inbound call will be transferred to if: + *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ */ + @JsonProperty("fallbackDestination") + public Optional getFallbackDestination() { + return fallbackDestination; + } + + /** + * @return These are the digits of the phone number you own on your Twilio. + */ + @JsonProperty("number") + public String getNumber() { + return number; + } + + /** + * @return This is the Twilio Account SID for the phone number. + */ + @JsonProperty("twilioAccountSid") + public String getTwilioAccountSid() { + return twilioAccountSid; + } + + /** + * @return This is the Twilio Auth Token for the phone number. + */ + @JsonProperty("twilioAuthToken") + public String getTwilioAuthToken() { + return twilioAuthToken; + } + + /** + * @return This is the name of the phone number. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the assistant that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the squad that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message. + *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTwilioPhoneNumberDto && equalTo((CreateTwilioPhoneNumberDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTwilioPhoneNumberDto other) { + return fallbackDestination.equals(other.fallbackDestination) + && number.equals(other.number) + && twilioAccountSid.equals(other.twilioAccountSid) + && twilioAuthToken.equals(other.twilioAuthToken) + && name.equals(other.name) + && assistantId.equals(other.assistantId) + && squadId.equals(other.squadId) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fallbackDestination, + this.number, + this.twilioAccountSid, + this.twilioAuthToken, + this.name, + this.assistantId, + this.squadId, + this.serverUrl, + this.serverUrlSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NumberStage builder() { + return new Builder(); + } + + public interface NumberStage { + TwilioAccountSidStage number(@NotNull String number); + + Builder from(CreateTwilioPhoneNumberDto other); + } + + public interface TwilioAccountSidStage { + TwilioAuthTokenStage twilioAccountSid(@NotNull String twilioAccountSid); + } + + public interface TwilioAuthTokenStage { + _FinalStage twilioAuthToken(@NotNull String twilioAuthToken); + } + + public interface _FinalStage { + CreateTwilioPhoneNumberDto build(); + + _FinalStage fallbackDestination(Optional fallbackDestination); + + _FinalStage fallbackDestination(CreateTwilioPhoneNumberDtoFallbackDestination fallbackDestination); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage assistantId(Optional assistantId); + + _FinalStage assistantId(String assistantId); + + _FinalStage squadId(Optional squadId); + + _FinalStage squadId(String squadId); + + _FinalStage serverUrl(Optional serverUrl); + + _FinalStage serverUrl(String serverUrl); + + _FinalStage serverUrlSecret(Optional serverUrlSecret); + + _FinalStage serverUrlSecret(String serverUrlSecret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NumberStage, TwilioAccountSidStage, TwilioAuthTokenStage, _FinalStage { + private String number; + + private String twilioAccountSid; + + private String twilioAuthToken; + + private Optional serverUrlSecret = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional fallbackDestination = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTwilioPhoneNumberDto other) { + fallbackDestination(other.getFallbackDestination()); + number(other.getNumber()); + twilioAccountSid(other.getTwilioAccountSid()); + twilioAuthToken(other.getTwilioAuthToken()); + name(other.getName()); + assistantId(other.getAssistantId()); + squadId(other.getSquadId()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + return this; + } + + /** + *

These are the digits of the phone number you own on your Twilio.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("number") + public TwilioAccountSidStage number(@NotNull String number) { + this.number = Objects.requireNonNull(number, "number must not be null"); + return this; + } + + /** + *

This is the Twilio Account SID for the phone number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("twilioAccountSid") + public TwilioAuthTokenStage twilioAccountSid(@NotNull String twilioAccountSid) { + this.twilioAccountSid = Objects.requireNonNull(twilioAccountSid, "twilioAccountSid must not be null"); + return this; + } + + /** + *

This is the Twilio Auth Token for the phone number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("twilioAuthToken") + public _FinalStage twilioAuthToken(@NotNull String twilioAuthToken) { + this.twilioAuthToken = Objects.requireNonNull(twilioAuthToken, "twilioAuthToken must not be null"); + return this; + } + + /** + *

This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret.

+ *

Same precedence logic as serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public _FinalStage serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + /** + *

This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message.

+ *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public _FinalStage serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + /** + *

This is the squad that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public _FinalStage squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + /** + *

This is the assistant that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public _FinalStage assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + /** + *

This is the name of the phone number. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the fallback destination an inbound call will be transferred to if:

+ *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fallbackDestination(CreateTwilioPhoneNumberDtoFallbackDestination fallbackDestination) { + this.fallbackDestination = Optional.ofNullable(fallbackDestination); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fallbackDestination", nulls = Nulls.SKIP) + public _FinalStage fallbackDestination( + Optional fallbackDestination) { + this.fallbackDestination = fallbackDestination; + return this; + } + + @java.lang.Override + public CreateTwilioPhoneNumberDto build() { + return new CreateTwilioPhoneNumberDto( + fallbackDestination, + number, + twilioAccountSid, + twilioAuthToken, + name, + assistantId, + squadId, + serverUrl, + serverUrlSecret, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateTwilioPhoneNumberDtoFallbackDestination.java b/src/main/java/com/vapi/api/types/CreateTwilioPhoneNumberDtoFallbackDestination.java new file mode 100644 index 0000000..7ec26e1 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateTwilioPhoneNumberDtoFallbackDestination.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateTwilioPhoneNumberDtoFallbackDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateTwilioPhoneNumberDtoFallbackDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateTwilioPhoneNumberDtoFallbackDestination number(TransferDestinationNumber value) { + return new CreateTwilioPhoneNumberDtoFallbackDestination(new NumberValue(value)); + } + + public static CreateTwilioPhoneNumberDtoFallbackDestination sip(TransferDestinationSip value) { + return new CreateTwilioPhoneNumberDtoFallbackDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTwilioPhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTwilioPhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateTwilioPhoneNumberDtoFallbackDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateVapiPhoneNumberDto.java b/src/main/java/com/vapi/api/types/CreateVapiPhoneNumberDto.java new file mode 100644 index 0000000..a86047e --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateVapiPhoneNumberDto.java @@ -0,0 +1,375 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVapiPhoneNumberDto.Builder.class) +public final class CreateVapiPhoneNumberDto { + private final Optional fallbackDestination; + + private final String sipUri; + + private final Optional name; + + private final Optional assistantId; + + private final Optional squadId; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Map additionalProperties; + + private CreateVapiPhoneNumberDto( + Optional fallbackDestination, + String sipUri, + Optional name, + Optional assistantId, + Optional squadId, + Optional serverUrl, + Optional serverUrlSecret, + Map additionalProperties) { + this.fallbackDestination = fallbackDestination; + this.sipUri = sipUri; + this.name = name; + this.assistantId = assistantId; + this.squadId = squadId; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the fallback destination an inbound call will be transferred to if: + *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ */ + @JsonProperty("fallbackDestination") + public Optional getFallbackDestination() { + return fallbackDestination; + } + + /** + * @return This is the SIP URI of the phone number. You can SIP INVITE this. The assistant attached to this number will answer. + *

This is case-insensitive.

+ */ + @JsonProperty("sipUri") + public String getSipUri() { + return sipUri; + } + + /** + * @return This is the name of the phone number. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the assistant that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the squad that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message. + *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVapiPhoneNumberDto && equalTo((CreateVapiPhoneNumberDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVapiPhoneNumberDto other) { + return fallbackDestination.equals(other.fallbackDestination) + && sipUri.equals(other.sipUri) + && name.equals(other.name) + && assistantId.equals(other.assistantId) + && squadId.equals(other.squadId) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fallbackDestination, + this.sipUri, + this.name, + this.assistantId, + this.squadId, + this.serverUrl, + this.serverUrlSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SipUriStage builder() { + return new Builder(); + } + + public interface SipUriStage { + _FinalStage sipUri(@NotNull String sipUri); + + Builder from(CreateVapiPhoneNumberDto other); + } + + public interface _FinalStage { + CreateVapiPhoneNumberDto build(); + + _FinalStage fallbackDestination(Optional fallbackDestination); + + _FinalStage fallbackDestination(CreateVapiPhoneNumberDtoFallbackDestination fallbackDestination); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage assistantId(Optional assistantId); + + _FinalStage assistantId(String assistantId); + + _FinalStage squadId(Optional squadId); + + _FinalStage squadId(String squadId); + + _FinalStage serverUrl(Optional serverUrl); + + _FinalStage serverUrl(String serverUrl); + + _FinalStage serverUrlSecret(Optional serverUrlSecret); + + _FinalStage serverUrlSecret(String serverUrlSecret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SipUriStage, _FinalStage { + private String sipUri; + + private Optional serverUrlSecret = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional fallbackDestination = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateVapiPhoneNumberDto other) { + fallbackDestination(other.getFallbackDestination()); + sipUri(other.getSipUri()); + name(other.getName()); + assistantId(other.getAssistantId()); + squadId(other.getSquadId()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + return this; + } + + /** + *

This is the SIP URI of the phone number. You can SIP INVITE this. The assistant attached to this number will answer.

+ *

This is case-insensitive.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sipUri") + public _FinalStage sipUri(@NotNull String sipUri) { + this.sipUri = Objects.requireNonNull(sipUri, "sipUri must not be null"); + return this; + } + + /** + *

This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret.

+ *

Same precedence logic as serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public _FinalStage serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + /** + *

This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message.

+ *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public _FinalStage serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + /** + *

This is the squad that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public _FinalStage squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + /** + *

This is the assistant that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public _FinalStage assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + /** + *

This is the name of the phone number. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the fallback destination an inbound call will be transferred to if:

+ *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fallbackDestination(CreateVapiPhoneNumberDtoFallbackDestination fallbackDestination) { + this.fallbackDestination = Optional.ofNullable(fallbackDestination); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fallbackDestination", nulls = Nulls.SKIP) + public _FinalStage fallbackDestination( + Optional fallbackDestination) { + this.fallbackDestination = fallbackDestination; + return this; + } + + @java.lang.Override + public CreateVapiPhoneNumberDto build() { + return new CreateVapiPhoneNumberDto( + fallbackDestination, + sipUri, + name, + assistantId, + squadId, + serverUrl, + serverUrlSecret, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateVapiPhoneNumberDtoFallbackDestination.java b/src/main/java/com/vapi/api/types/CreateVapiPhoneNumberDtoFallbackDestination.java new file mode 100644 index 0000000..f0629ca --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateVapiPhoneNumberDtoFallbackDestination.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateVapiPhoneNumberDtoFallbackDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateVapiPhoneNumberDtoFallbackDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateVapiPhoneNumberDtoFallbackDestination number(TransferDestinationNumber value) { + return new CreateVapiPhoneNumberDtoFallbackDestination(new NumberValue(value)); + } + + public static CreateVapiPhoneNumberDtoFallbackDestination sip(TransferDestinationSip value) { + return new CreateVapiPhoneNumberDtoFallbackDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateVapiPhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateVapiPhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateVapiPhoneNumberDtoFallbackDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateVoicemailToolDto.java b/src/main/java/com/vapi/api/types/CreateVoicemailToolDto.java new file mode 100644 index 0000000..1f00354 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateVoicemailToolDto.java @@ -0,0 +1,190 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVoicemailToolDto.Builder.class) +public final class CreateVoicemailToolDto { + private final Optional async; + + private final Optional> messages; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private CreateVoicemailToolDto( + Optional async, + Optional> messages, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVoicemailToolDto && equalTo((CreateVoicemailToolDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVoicemailToolDto other) { + return async.equals(other.async) + && messages.equals(other.messages) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.async, this.messages, this.function, this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional async = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional server = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateVoicemailToolDto other) { + async(other.getAsync()); + messages(other.getMessages()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public Builder async(Optional async) { + this.async = async; + return this; + } + + public Builder async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public Builder function(Optional function) { + this.function = function; + return this; + } + + public Builder function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public Builder server(Optional server) { + this.server = server; + return this; + } + + public Builder server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + public CreateVoicemailToolDto build() { + return new CreateVoicemailToolDto(async, messages, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateVoicemailToolDtoMessagesItem.java b/src/main/java/com/vapi/api/types/CreateVoicemailToolDtoMessagesItem.java new file mode 100644 index 0000000..0423752 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateVoicemailToolDtoMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateVoicemailToolDtoMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateVoicemailToolDtoMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateVoicemailToolDtoMessagesItem requestStart(ToolMessageStart value) { + return new CreateVoicemailToolDtoMessagesItem(new RequestStartValue(value)); + } + + public static CreateVoicemailToolDtoMessagesItem requestComplete(ToolMessageComplete value) { + return new CreateVoicemailToolDtoMessagesItem(new RequestCompleteValue(value)); + } + + public static CreateVoicemailToolDtoMessagesItem requestFailed(ToolMessageFailed value) { + return new CreateVoicemailToolDtoMessagesItem(new RequestFailedValue(value)); + } + + public static CreateVoicemailToolDtoMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new CreateVoicemailToolDtoMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateVoicemailToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateVoicemailToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateVoicemailToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateVoicemailToolDtoMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateVoicemailToolDtoMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateVonageCredentialDto.java b/src/main/java/com/vapi/api/types/CreateVonageCredentialDto.java new file mode 100644 index 0000000..b6cf7e6 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateVonageCredentialDto.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVonageCredentialDto.Builder.class) +public final class CreateVonageCredentialDto { + private final String apiSecret; + + private final String apiKey; + + private final Map additionalProperties; + + private CreateVonageCredentialDto(String apiSecret, String apiKey, Map additionalProperties) { + this.apiSecret = apiSecret; + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "vonage"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiSecret") + public String getApiSecret() { + return apiSecret; + } + + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVonageCredentialDto && equalTo((CreateVonageCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVonageCredentialDto other) { + return apiSecret.equals(other.apiSecret) && apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiSecret, this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiSecretStage builder() { + return new Builder(); + } + + public interface ApiSecretStage { + ApiKeyStage apiSecret(@NotNull String apiSecret); + + Builder from(CreateVonageCredentialDto other); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + } + + public interface _FinalStage { + CreateVonageCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiSecretStage, ApiKeyStage, _FinalStage { + private String apiSecret; + + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateVonageCredentialDto other) { + apiSecret(other.getApiSecret()); + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiSecret") + public ApiKeyStage apiSecret(@NotNull String apiSecret) { + this.apiSecret = Objects.requireNonNull(apiSecret, "apiSecret must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public CreateVonageCredentialDto build() { + return new CreateVonageCredentialDto(apiSecret, apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateVonagePhoneNumberDto.java b/src/main/java/com/vapi/api/types/CreateVonagePhoneNumberDto.java new file mode 100644 index 0000000..c52f718 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateVonagePhoneNumberDto.java @@ -0,0 +1,406 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateVonagePhoneNumberDto.Builder.class) +public final class CreateVonagePhoneNumberDto { + private final Optional fallbackDestination; + + private final String number; + + private final String credentialId; + + private final Optional name; + + private final Optional assistantId; + + private final Optional squadId; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Map additionalProperties; + + private CreateVonagePhoneNumberDto( + Optional fallbackDestination, + String number, + String credentialId, + Optional name, + Optional assistantId, + Optional squadId, + Optional serverUrl, + Optional serverUrlSecret, + Map additionalProperties) { + this.fallbackDestination = fallbackDestination; + this.number = number; + this.credentialId = credentialId; + this.name = name; + this.assistantId = assistantId; + this.squadId = squadId; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the fallback destination an inbound call will be transferred to if: + *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ */ + @JsonProperty("fallbackDestination") + public Optional getFallbackDestination() { + return fallbackDestination; + } + + /** + * @return These are the digits of the phone number you own on your Vonage. + */ + @JsonProperty("number") + public String getNumber() { + return number; + } + + /** + * @return This is the credential that is used to make outgoing calls, and do operations like call transfer and hang up. + */ + @JsonProperty("credentialId") + public String getCredentialId() { + return credentialId; + } + + /** + * @return This is the name of the phone number. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the assistant that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the squad that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message. + *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateVonagePhoneNumberDto && equalTo((CreateVonagePhoneNumberDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateVonagePhoneNumberDto other) { + return fallbackDestination.equals(other.fallbackDestination) + && number.equals(other.number) + && credentialId.equals(other.credentialId) + && name.equals(other.name) + && assistantId.equals(other.assistantId) + && squadId.equals(other.squadId) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fallbackDestination, + this.number, + this.credentialId, + this.name, + this.assistantId, + this.squadId, + this.serverUrl, + this.serverUrlSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NumberStage builder() { + return new Builder(); + } + + public interface NumberStage { + CredentialIdStage number(@NotNull String number); + + Builder from(CreateVonagePhoneNumberDto other); + } + + public interface CredentialIdStage { + _FinalStage credentialId(@NotNull String credentialId); + } + + public interface _FinalStage { + CreateVonagePhoneNumberDto build(); + + _FinalStage fallbackDestination(Optional fallbackDestination); + + _FinalStage fallbackDestination(CreateVonagePhoneNumberDtoFallbackDestination fallbackDestination); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage assistantId(Optional assistantId); + + _FinalStage assistantId(String assistantId); + + _FinalStage squadId(Optional squadId); + + _FinalStage squadId(String squadId); + + _FinalStage serverUrl(Optional serverUrl); + + _FinalStage serverUrl(String serverUrl); + + _FinalStage serverUrlSecret(Optional serverUrlSecret); + + _FinalStage serverUrlSecret(String serverUrlSecret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NumberStage, CredentialIdStage, _FinalStage { + private String number; + + private String credentialId; + + private Optional serverUrlSecret = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional fallbackDestination = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateVonagePhoneNumberDto other) { + fallbackDestination(other.getFallbackDestination()); + number(other.getNumber()); + credentialId(other.getCredentialId()); + name(other.getName()); + assistantId(other.getAssistantId()); + squadId(other.getSquadId()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + return this; + } + + /** + *

These are the digits of the phone number you own on your Vonage.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("number") + public CredentialIdStage number(@NotNull String number) { + this.number = Objects.requireNonNull(number, "number must not be null"); + return this; + } + + /** + *

This is the credential that is used to make outgoing calls, and do operations like call transfer and hang up.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("credentialId") + public _FinalStage credentialId(@NotNull String credentialId) { + this.credentialId = Objects.requireNonNull(credentialId, "credentialId must not be null"); + return this; + } + + /** + *

This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret.

+ *

Same precedence logic as serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public _FinalStage serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + /** + *

This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message.

+ *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public _FinalStage serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + /** + *

This is the squad that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public _FinalStage squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + /** + *

This is the assistant that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public _FinalStage assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + /** + *

This is the name of the phone number. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the fallback destination an inbound call will be transferred to if:

+ *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fallbackDestination(CreateVonagePhoneNumberDtoFallbackDestination fallbackDestination) { + this.fallbackDestination = Optional.ofNullable(fallbackDestination); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fallbackDestination", nulls = Nulls.SKIP) + public _FinalStage fallbackDestination( + Optional fallbackDestination) { + this.fallbackDestination = fallbackDestination; + return this; + } + + @java.lang.Override + public CreateVonagePhoneNumberDto build() { + return new CreateVonagePhoneNumberDto( + fallbackDestination, + number, + credentialId, + name, + assistantId, + squadId, + serverUrl, + serverUrlSecret, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateVonagePhoneNumberDtoFallbackDestination.java b/src/main/java/com/vapi/api/types/CreateVonagePhoneNumberDtoFallbackDestination.java new file mode 100644 index 0000000..4166033 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateVonagePhoneNumberDtoFallbackDestination.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateVonagePhoneNumberDtoFallbackDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateVonagePhoneNumberDtoFallbackDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateVonagePhoneNumberDtoFallbackDestination number(TransferDestinationNumber value) { + return new CreateVonagePhoneNumberDtoFallbackDestination(new NumberValue(value)); + } + + public static CreateVonagePhoneNumberDtoFallbackDestination sip(TransferDestinationSip value) { + return new CreateVonagePhoneNumberDtoFallbackDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateVonagePhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateVonagePhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateVonagePhoneNumberDtoFallbackDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateWebCallDto.java b/src/main/java/com/vapi/api/types/CreateWebCallDto.java new file mode 100644 index 0000000..f3336db --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateWebCallDto.java @@ -0,0 +1,209 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateWebCallDto.Builder.class) +public final class CreateWebCallDto { + private final Optional assistantId; + + private final Optional assistant; + + private final Optional assistantOverrides; + + private final Optional squadId; + + private final Optional squad; + + private final Map additionalProperties; + + private CreateWebCallDto( + Optional assistantId, + Optional assistant, + Optional assistantOverrides, + Optional squadId, + Optional squad, + Map additionalProperties) { + this.assistantId = assistantId; + this.assistant = assistant; + this.assistantOverrides = assistantOverrides; + this.squadId = squadId; + this.squad = squad; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the assistant that will be used for the call. To use a transient assistant, use assistant instead. + */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the assistant that will be used for the call. To use an existing assistant, use assistantId instead. + */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return These are the overrides for the assistant or assistantId's settings and template variables. + */ + @JsonProperty("assistantOverrides") + public Optional getAssistantOverrides() { + return assistantOverrides; + } + + /** + * @return This is the squad that will be used for the call. To use a transient squad, use squad instead. + */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is a squad that will be used for the call. To use an existing squad, use squadId instead. + */ + @JsonProperty("squad") + public Optional getSquad() { + return squad; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateWebCallDto && equalTo((CreateWebCallDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateWebCallDto other) { + return assistantId.equals(other.assistantId) + && assistant.equals(other.assistant) + && assistantOverrides.equals(other.assistantOverrides) + && squadId.equals(other.squadId) + && squad.equals(other.squad); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.assistantId, this.assistant, this.assistantOverrides, this.squadId, this.squad); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional assistantId = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional assistantOverrides = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional squad = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateWebCallDto other) { + assistantId(other.getAssistantId()); + assistant(other.getAssistant()); + assistantOverrides(other.getAssistantOverrides()); + squadId(other.getSquadId()); + squad(other.getSquad()); + return this; + } + + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public Builder assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + public Builder assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public Builder assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + public Builder assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @JsonSetter(value = "assistantOverrides", nulls = Nulls.SKIP) + public Builder assistantOverrides(Optional assistantOverrides) { + this.assistantOverrides = assistantOverrides; + return this; + } + + public Builder assistantOverrides(AssistantOverrides assistantOverrides) { + this.assistantOverrides = Optional.ofNullable(assistantOverrides); + return this; + } + + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public Builder squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + public Builder squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @JsonSetter(value = "squad", nulls = Nulls.SKIP) + public Builder squad(Optional squad) { + this.squad = squad; + return this; + } + + public Builder squad(CreateSquadDto squad) { + this.squad = Optional.ofNullable(squad); + return this; + } + + public CreateWebCallDto build() { + return new CreateWebCallDto( + assistantId, assistant, assistantOverrides, squadId, squad, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateWorkflowBlockDto.java b/src/main/java/com/vapi/api/types/CreateWorkflowBlockDto.java new file mode 100644 index 0000000..fcb63e4 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateWorkflowBlockDto.java @@ -0,0 +1,225 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateWorkflowBlockDto.Builder.class) +public final class CreateWorkflowBlockDto { + private final Optional> messages; + + private final Optional inputSchema; + + private final Optional outputSchema; + + private final Optional> steps; + + private final Optional name; + + private final Map additionalProperties; + + private CreateWorkflowBlockDto( + Optional> messages, + Optional inputSchema, + Optional outputSchema, + Optional> steps, + Optional name, + Map additionalProperties) { + this.messages = messages; + this.inputSchema = inputSchema; + this.outputSchema = outputSchema; + this.steps = steps; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the pre-configured messages that will be spoken to the user while the block is running. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the input schema for the block. This is the input the block needs to run. It's given to the block as steps[0].input + *

These are accessible as variables:

+ *
    + *
  • ({{input.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.input.propertyName}}) in context of the workflow
  • + *
+ */ + @JsonProperty("inputSchema") + public Optional getInputSchema() { + return inputSchema; + } + + /** + * @return This is the output schema for the block. This is the output the block will return to the workflow ({{stepName.output}}). + *

These are accessible as variables:

+ *
    + *
  • ({{output.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
  • + *
  • ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2)
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ */ + @JsonProperty("outputSchema") + public Optional getOutputSchema() { + return outputSchema; + } + + /** + * @return These are the steps in the workflow. + */ + @JsonProperty("steps") + public Optional> getSteps() { + return steps; + } + + /** + * @return This is the name of the block. This is just for your reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateWorkflowBlockDto && equalTo((CreateWorkflowBlockDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateWorkflowBlockDto other) { + return messages.equals(other.messages) + && inputSchema.equals(other.inputSchema) + && outputSchema.equals(other.outputSchema) + && steps.equals(other.steps) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.messages, this.inputSchema, this.outputSchema, this.steps, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> messages = Optional.empty(); + + private Optional inputSchema = Optional.empty(); + + private Optional outputSchema = Optional.empty(); + + private Optional> steps = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateWorkflowBlockDto other) { + messages(other.getMessages()); + inputSchema(other.getInputSchema()); + outputSchema(other.getOutputSchema()); + steps(other.getSteps()); + name(other.getName()); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "inputSchema", nulls = Nulls.SKIP) + public Builder inputSchema(Optional inputSchema) { + this.inputSchema = inputSchema; + return this; + } + + public Builder inputSchema(JsonSchema inputSchema) { + this.inputSchema = Optional.ofNullable(inputSchema); + return this; + } + + @JsonSetter(value = "outputSchema", nulls = Nulls.SKIP) + public Builder outputSchema(Optional outputSchema) { + this.outputSchema = outputSchema; + return this; + } + + public Builder outputSchema(JsonSchema outputSchema) { + this.outputSchema = Optional.ofNullable(outputSchema); + return this; + } + + @JsonSetter(value = "steps", nulls = Nulls.SKIP) + public Builder steps(Optional> steps) { + this.steps = steps; + return this; + } + + public Builder steps(List steps) { + this.steps = Optional.ofNullable(steps); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + public CreateWorkflowBlockDto build() { + return new CreateWorkflowBlockDto(messages, inputSchema, outputSchema, steps, name, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateWorkflowBlockDtoMessagesItem.java b/src/main/java/com/vapi/api/types/CreateWorkflowBlockDtoMessagesItem.java new file mode 100644 index 0000000..06238ce --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateWorkflowBlockDtoMessagesItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateWorkflowBlockDtoMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateWorkflowBlockDtoMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateWorkflowBlockDtoMessagesItem blockStart(BlockStartMessage value) { + return new CreateWorkflowBlockDtoMessagesItem(new BlockStartValue(value)); + } + + public static CreateWorkflowBlockDtoMessagesItem blockComplete(BlockCompleteMessage value) { + return new CreateWorkflowBlockDtoMessagesItem(new BlockCompleteValue(value)); + } + + public boolean isBlockStart() { + return value instanceof BlockStartValue; + } + + public boolean isBlockComplete() { + return value instanceof BlockCompleteValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getBlockStart() { + if (isBlockStart()) { + return Optional.of(((BlockStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getBlockComplete() { + if (isBlockComplete()) { + return Optional.of(((BlockCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitBlockStart(BlockStartMessage blockStart); + + T visitBlockComplete(BlockCompleteMessage blockComplete); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(BlockStartValue.class), @JsonSubTypes.Type(BlockCompleteValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("block-start") + private static final class BlockStartValue implements Value { + @JsonUnwrapped + private BlockStartMessage value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BlockStartValue() {} + + private BlockStartValue(BlockStartMessage value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBlockStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockStartValue && equalTo((BlockStartValue) other); + } + + private boolean equalTo(BlockStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateWorkflowBlockDtoMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("block-complete") + private static final class BlockCompleteValue implements Value { + @JsonUnwrapped + private BlockCompleteMessage value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BlockCompleteValue() {} + + private BlockCompleteValue(BlockCompleteMessage value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBlockComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockCompleteValue && equalTo((BlockCompleteValue) other); + } + + private boolean equalTo(BlockCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateWorkflowBlockDtoMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateWorkflowBlockDtoMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CreateWorkflowBlockDtoStepsItem.java b/src/main/java/com/vapi/api/types/CreateWorkflowBlockDtoStepsItem.java new file mode 100644 index 0000000..1b6018c --- /dev/null +++ b/src/main/java/com/vapi/api/types/CreateWorkflowBlockDtoStepsItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CreateWorkflowBlockDtoStepsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CreateWorkflowBlockDtoStepsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CreateWorkflowBlockDtoStepsItem handoff(HandoffStep value) { + return new CreateWorkflowBlockDtoStepsItem(new HandoffValue(value)); + } + + public static CreateWorkflowBlockDtoStepsItem callback(CallbackStep value) { + return new CreateWorkflowBlockDtoStepsItem(new CallbackValue(value)); + } + + public boolean isHandoff() { + return value instanceof HandoffValue; + } + + public boolean isCallback() { + return value instanceof CallbackValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getHandoff() { + if (isHandoff()) { + return Optional.of(((HandoffValue) value).value); + } + return Optional.empty(); + } + + public Optional getCallback() { + if (isCallback()) { + return Optional.of(((CallbackValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitHandoff(HandoffStep handoff); + + T visitCallback(CallbackStep callback); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(HandoffValue.class), @JsonSubTypes.Type(CallbackValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("handoff") + private static final class HandoffValue implements Value { + @JsonUnwrapped + private HandoffStep value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private HandoffValue() {} + + private HandoffValue(HandoffStep value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitHandoff(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof HandoffValue && equalTo((HandoffValue) other); + } + + private boolean equalTo(HandoffValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateWorkflowBlockDtoStepsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("callback") + private static final class CallbackValue implements Value { + @JsonUnwrapped + private CallbackStep value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CallbackValue() {} + + private CallbackValue(CallbackStep value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCallback(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CallbackValue && equalTo((CallbackValue) other); + } + + private boolean equalTo(CallbackValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CreateWorkflowBlockDtoStepsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CreateWorkflowBlockDtoStepsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/CustomLlmCredential.java b/src/main/java/com/vapi/api/types/CustomLlmCredential.java new file mode 100644 index 0000000..281e869 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CustomLlmCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CustomLlmCredential.Builder.class) +public final class CustomLlmCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private CustomLlmCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "custom-llm"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CustomLlmCredential && equalTo((CustomLlmCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CustomLlmCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(CustomLlmCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + CustomLlmCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CustomLlmCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public CustomLlmCredential build() { + return new CustomLlmCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CustomLlmModel.java b/src/main/java/com/vapi/api/types/CustomLlmModel.java new file mode 100644 index 0000000..81e1246 --- /dev/null +++ b/src/main/java/com/vapi/api/types/CustomLlmModel.java @@ -0,0 +1,527 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CustomLlmModel.Builder.class) +public final class CustomLlmModel { + private final Optional> messages; + + private final Optional> tools; + + private final Optional> toolIds; + + private final Optional metadataSendMode; + + private final String url; + + private final String model; + + private final Optional temperature; + + private final Optional knowledgeBase; + + private final Optional maxTokens; + + private final Optional emotionRecognitionEnabled; + + private final Optional numFastTurns; + + private final Map additionalProperties; + + private CustomLlmModel( + Optional> messages, + Optional> tools, + Optional> toolIds, + Optional metadataSendMode, + String url, + String model, + Optional temperature, + Optional knowledgeBase, + Optional maxTokens, + Optional emotionRecognitionEnabled, + Optional numFastTurns, + Map additionalProperties) { + this.messages = messages; + this.tools = tools; + this.toolIds = toolIds; + this.metadataSendMode = metadataSendMode; + this.url = url; + this.model = model; + this.temperature = temperature; + this.knowledgeBase = knowledgeBase; + this.maxTokens = maxTokens; + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + this.numFastTurns = numFastTurns; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the starting state for the conversation. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return These are the tools that the assistant can use during the call. To use existing tools, use toolIds. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("tools") + public Optional> getTools() { + return tools; + } + + /** + * @return These are the tools that the assistant can use during the call. To use transient tools, use tools. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("toolIds") + public Optional> getToolIds() { + return toolIds; + } + + /** + * @return This determines whether metadata is sent in requests to the custom provider. + *
    + *
  • off will not send any metadata. payload will look like { messages }
  • + *
  • variable will send assistant.metadata as a variable on the payload. payload will look like { messages, metadata }
  • + *
  • destructured will send assistant.metadata fields directly on the payload. payload will look like { messages, ...metadata }
  • + *
+ *

Further, variable and destructured will send call, phoneNumber, and customer objects in the payload.

+ *

Default is variable.

+ */ + @JsonProperty("metadataSendMode") + public Optional getMetadataSendMode() { + return metadataSendMode; + } + + /** + * @return These is the URL we'll use for the OpenAI client's baseURL. Ex. https://openrouter.ai/api/v1 + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + /** + * @return This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + */ + @JsonProperty("model") + public String getModel() { + return model; + } + + /** + * @return This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + */ + @JsonProperty("temperature") + public Optional getTemperature() { + return temperature; + } + + /** + * @return These are the options for the knowledge base. + */ + @JsonProperty("knowledgeBase") + public Optional getKnowledgeBase() { + return knowledgeBase; + } + + /** + * @return This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. + */ + @JsonProperty("maxTokens") + public Optional getMaxTokens() { + return maxTokens; + } + + /** + * @return This determines whether we detect user's emotion while they speak and send it as an additional info to model. + *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ */ + @JsonProperty("emotionRecognitionEnabled") + public Optional getEmotionRecognitionEnabled() { + return emotionRecognitionEnabled; + } + + /** + * @return This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai. + *

Default is 0.

+ *

@default 0

+ */ + @JsonProperty("numFastTurns") + public Optional getNumFastTurns() { + return numFastTurns; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CustomLlmModel && equalTo((CustomLlmModel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CustomLlmModel other) { + return messages.equals(other.messages) + && tools.equals(other.tools) + && toolIds.equals(other.toolIds) + && metadataSendMode.equals(other.metadataSendMode) + && url.equals(other.url) + && model.equals(other.model) + && temperature.equals(other.temperature) + && knowledgeBase.equals(other.knowledgeBase) + && maxTokens.equals(other.maxTokens) + && emotionRecognitionEnabled.equals(other.emotionRecognitionEnabled) + && numFastTurns.equals(other.numFastTurns); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.messages, + this.tools, + this.toolIds, + this.metadataSendMode, + this.url, + this.model, + this.temperature, + this.knowledgeBase, + this.maxTokens, + this.emotionRecognitionEnabled, + this.numFastTurns); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + ModelStage url(@NotNull String url); + + Builder from(CustomLlmModel other); + } + + public interface ModelStage { + _FinalStage model(@NotNull String model); + } + + public interface _FinalStage { + CustomLlmModel build(); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage tools(Optional> tools); + + _FinalStage tools(List tools); + + _FinalStage toolIds(Optional> toolIds); + + _FinalStage toolIds(List toolIds); + + _FinalStage metadataSendMode(Optional metadataSendMode); + + _FinalStage metadataSendMode(CustomLlmModelMetadataSendMode metadataSendMode); + + _FinalStage temperature(Optional temperature); + + _FinalStage temperature(Double temperature); + + _FinalStage knowledgeBase(Optional knowledgeBase); + + _FinalStage knowledgeBase(KnowledgeBase knowledgeBase); + + _FinalStage maxTokens(Optional maxTokens); + + _FinalStage maxTokens(Double maxTokens); + + _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled); + + _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled); + + _FinalStage numFastTurns(Optional numFastTurns); + + _FinalStage numFastTurns(Double numFastTurns); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, ModelStage, _FinalStage { + private String url; + + private String model; + + private Optional numFastTurns = Optional.empty(); + + private Optional emotionRecognitionEnabled = Optional.empty(); + + private Optional maxTokens = Optional.empty(); + + private Optional knowledgeBase = Optional.empty(); + + private Optional temperature = Optional.empty(); + + private Optional metadataSendMode = Optional.empty(); + + private Optional> toolIds = Optional.empty(); + + private Optional> tools = Optional.empty(); + + private Optional> messages = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CustomLlmModel other) { + messages(other.getMessages()); + tools(other.getTools()); + toolIds(other.getToolIds()); + metadataSendMode(other.getMetadataSendMode()); + url(other.getUrl()); + model(other.getModel()); + temperature(other.getTemperature()); + knowledgeBase(other.getKnowledgeBase()); + maxTokens(other.getMaxTokens()); + emotionRecognitionEnabled(other.getEmotionRecognitionEnabled()); + numFastTurns(other.getNumFastTurns()); + return this; + } + + /** + *

These is the URL we'll use for the OpenAI client's baseURL. Ex. https://openrouter.ai/api/v1

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public ModelStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + /** + *

This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("model") + public _FinalStage model(@NotNull String model) { + this.model = Objects.requireNonNull(model, "model must not be null"); + return this; + } + + /** + *

This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai.

+ *

Default is 0.

+ *

@default 0

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numFastTurns(Double numFastTurns) { + this.numFastTurns = Optional.ofNullable(numFastTurns); + return this; + } + + @java.lang.Override + @JsonSetter(value = "numFastTurns", nulls = Nulls.SKIP) + public _FinalStage numFastTurns(Optional numFastTurns) { + this.numFastTurns = numFastTurns; + return this; + } + + /** + *

This determines whether we detect user's emotion while they speak and send it as an additional info to model.

+ *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = Optional.ofNullable(emotionRecognitionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "emotionRecognitionEnabled", nulls = Nulls.SKIP) + public _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + return this; + } + + /** + *

This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxTokens(Double maxTokens) { + this.maxTokens = Optional.ofNullable(maxTokens); + return this; + } + + @java.lang.Override + @JsonSetter(value = "maxTokens", nulls = Nulls.SKIP) + public _FinalStage maxTokens(Optional maxTokens) { + this.maxTokens = maxTokens; + return this; + } + + /** + *

These are the options for the knowledge base.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage knowledgeBase(KnowledgeBase knowledgeBase) { + this.knowledgeBase = Optional.ofNullable(knowledgeBase); + return this; + } + + @java.lang.Override + @JsonSetter(value = "knowledgeBase", nulls = Nulls.SKIP) + public _FinalStage knowledgeBase(Optional knowledgeBase) { + this.knowledgeBase = knowledgeBase; + return this; + } + + /** + *

This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage temperature(Double temperature) { + this.temperature = Optional.ofNullable(temperature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "temperature", nulls = Nulls.SKIP) + public _FinalStage temperature(Optional temperature) { + this.temperature = temperature; + return this; + } + + /** + *

This determines whether metadata is sent in requests to the custom provider.

+ *
    + *
  • off will not send any metadata. payload will look like { messages }
  • + *
  • variable will send assistant.metadata as a variable on the payload. payload will look like { messages, metadata }
  • + *
  • destructured will send assistant.metadata fields directly on the payload. payload will look like { messages, ...metadata }
  • + *
+ *

Further, variable and destructured will send call, phoneNumber, and customer objects in the payload.

+ *

Default is variable.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage metadataSendMode(CustomLlmModelMetadataSendMode metadataSendMode) { + this.metadataSendMode = Optional.ofNullable(metadataSendMode); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metadataSendMode", nulls = Nulls.SKIP) + public _FinalStage metadataSendMode(Optional metadataSendMode) { + this.metadataSendMode = metadataSendMode; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use transient tools, use tools.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toolIds(List toolIds) { + this.toolIds = Optional.ofNullable(toolIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "toolIds", nulls = Nulls.SKIP) + public _FinalStage toolIds(Optional> toolIds) { + this.toolIds = toolIds; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use existing tools, use toolIds.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tools(List tools) { + this.tools = Optional.ofNullable(tools); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tools", nulls = Nulls.SKIP) + public _FinalStage tools(Optional> tools) { + this.tools = tools; + return this; + } + + /** + *

This is the starting state for the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + @java.lang.Override + public CustomLlmModel build() { + return new CustomLlmModel( + messages, + tools, + toolIds, + metadataSendMode, + url, + model, + temperature, + knowledgeBase, + maxTokens, + emotionRecognitionEnabled, + numFastTurns, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/CustomLlmModelMetadataSendMode.java b/src/main/java/com/vapi/api/types/CustomLlmModelMetadataSendMode.java new file mode 100644 index 0000000..99134ed --- /dev/null +++ b/src/main/java/com/vapi/api/types/CustomLlmModelMetadataSendMode.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum CustomLlmModelMetadataSendMode { + OFF("off"), + + VARIABLE("variable"), + + DESTRUCTURED("destructured"); + + private final String value; + + CustomLlmModelMetadataSendMode(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/CustomLlmModelToolsItem.java b/src/main/java/com/vapi/api/types/CustomLlmModelToolsItem.java new file mode 100644 index 0000000..ce9211e --- /dev/null +++ b/src/main/java/com/vapi/api/types/CustomLlmModelToolsItem.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class CustomLlmModelToolsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private CustomLlmModelToolsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static CustomLlmModelToolsItem dtmf(CreateDtmfToolDto value) { + return new CustomLlmModelToolsItem(new DtmfValue(value)); + } + + public static CustomLlmModelToolsItem endCall(CreateEndCallToolDto value) { + return new CustomLlmModelToolsItem(new EndCallValue(value)); + } + + public static CustomLlmModelToolsItem voicemail(CreateVoicemailToolDto value) { + return new CustomLlmModelToolsItem(new VoicemailValue(value)); + } + + public static CustomLlmModelToolsItem function(CreateFunctionToolDto value) { + return new CustomLlmModelToolsItem(new FunctionValue(value)); + } + + public static CustomLlmModelToolsItem ghl(CreateGhlToolDto value) { + return new CustomLlmModelToolsItem(new GhlValue(value)); + } + + public static CustomLlmModelToolsItem make(CreateMakeToolDto value) { + return new CustomLlmModelToolsItem(new MakeValue(value)); + } + + public static CustomLlmModelToolsItem transferCall(CreateTransferCallToolDto value) { + return new CustomLlmModelToolsItem(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CustomLlmModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CustomLlmModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CustomLlmModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CustomLlmModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CustomLlmModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CustomLlmModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "CustomLlmModelToolsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "CustomLlmModelToolsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/DeepInfraCredential.java b/src/main/java/com/vapi/api/types/DeepInfraCredential.java new file mode 100644 index 0000000..57793c4 --- /dev/null +++ b/src/main/java/com/vapi/api/types/DeepInfraCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeepInfraCredential.Builder.class) +public final class DeepInfraCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private DeepInfraCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "deepinfra"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepInfraCredential && equalTo((DeepInfraCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeepInfraCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(DeepInfraCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + DeepInfraCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeepInfraCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public DeepInfraCredential build() { + return new DeepInfraCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/DeepInfraModel.java b/src/main/java/com/vapi/api/types/DeepInfraModel.java new file mode 100644 index 0000000..945a5e3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/DeepInfraModel.java @@ -0,0 +1,441 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeepInfraModel.Builder.class) +public final class DeepInfraModel { + private final Optional> messages; + + private final Optional> tools; + + private final Optional> toolIds; + + private final String model; + + private final Optional temperature; + + private final Optional knowledgeBase; + + private final Optional maxTokens; + + private final Optional emotionRecognitionEnabled; + + private final Optional numFastTurns; + + private final Map additionalProperties; + + private DeepInfraModel( + Optional> messages, + Optional> tools, + Optional> toolIds, + String model, + Optional temperature, + Optional knowledgeBase, + Optional maxTokens, + Optional emotionRecognitionEnabled, + Optional numFastTurns, + Map additionalProperties) { + this.messages = messages; + this.tools = tools; + this.toolIds = toolIds; + this.model = model; + this.temperature = temperature; + this.knowledgeBase = knowledgeBase; + this.maxTokens = maxTokens; + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + this.numFastTurns = numFastTurns; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the starting state for the conversation. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return These are the tools that the assistant can use during the call. To use existing tools, use toolIds. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("tools") + public Optional> getTools() { + return tools; + } + + /** + * @return These are the tools that the assistant can use during the call. To use transient tools, use tools. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("toolIds") + public Optional> getToolIds() { + return toolIds; + } + + /** + * @return This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + */ + @JsonProperty("model") + public String getModel() { + return model; + } + + /** + * @return This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + */ + @JsonProperty("temperature") + public Optional getTemperature() { + return temperature; + } + + /** + * @return These are the options for the knowledge base. + */ + @JsonProperty("knowledgeBase") + public Optional getKnowledgeBase() { + return knowledgeBase; + } + + /** + * @return This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. + */ + @JsonProperty("maxTokens") + public Optional getMaxTokens() { + return maxTokens; + } + + /** + * @return This determines whether we detect user's emotion while they speak and send it as an additional info to model. + *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ */ + @JsonProperty("emotionRecognitionEnabled") + public Optional getEmotionRecognitionEnabled() { + return emotionRecognitionEnabled; + } + + /** + * @return This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai. + *

Default is 0.

+ *

@default 0

+ */ + @JsonProperty("numFastTurns") + public Optional getNumFastTurns() { + return numFastTurns; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepInfraModel && equalTo((DeepInfraModel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeepInfraModel other) { + return messages.equals(other.messages) + && tools.equals(other.tools) + && toolIds.equals(other.toolIds) + && model.equals(other.model) + && temperature.equals(other.temperature) + && knowledgeBase.equals(other.knowledgeBase) + && maxTokens.equals(other.maxTokens) + && emotionRecognitionEnabled.equals(other.emotionRecognitionEnabled) + && numFastTurns.equals(other.numFastTurns); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.messages, + this.tools, + this.toolIds, + this.model, + this.temperature, + this.knowledgeBase, + this.maxTokens, + this.emotionRecognitionEnabled, + this.numFastTurns); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + _FinalStage model(@NotNull String model); + + Builder from(DeepInfraModel other); + } + + public interface _FinalStage { + DeepInfraModel build(); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage tools(Optional> tools); + + _FinalStage tools(List tools); + + _FinalStage toolIds(Optional> toolIds); + + _FinalStage toolIds(List toolIds); + + _FinalStage temperature(Optional temperature); + + _FinalStage temperature(Double temperature); + + _FinalStage knowledgeBase(Optional knowledgeBase); + + _FinalStage knowledgeBase(KnowledgeBase knowledgeBase); + + _FinalStage maxTokens(Optional maxTokens); + + _FinalStage maxTokens(Double maxTokens); + + _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled); + + _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled); + + _FinalStage numFastTurns(Optional numFastTurns); + + _FinalStage numFastTurns(Double numFastTurns); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, _FinalStage { + private String model; + + private Optional numFastTurns = Optional.empty(); + + private Optional emotionRecognitionEnabled = Optional.empty(); + + private Optional maxTokens = Optional.empty(); + + private Optional knowledgeBase = Optional.empty(); + + private Optional temperature = Optional.empty(); + + private Optional> toolIds = Optional.empty(); + + private Optional> tools = Optional.empty(); + + private Optional> messages = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeepInfraModel other) { + messages(other.getMessages()); + tools(other.getTools()); + toolIds(other.getToolIds()); + model(other.getModel()); + temperature(other.getTemperature()); + knowledgeBase(other.getKnowledgeBase()); + maxTokens(other.getMaxTokens()); + emotionRecognitionEnabled(other.getEmotionRecognitionEnabled()); + numFastTurns(other.getNumFastTurns()); + return this; + } + + /** + *

This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("model") + public _FinalStage model(@NotNull String model) { + this.model = Objects.requireNonNull(model, "model must not be null"); + return this; + } + + /** + *

This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai.

+ *

Default is 0.

+ *

@default 0

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numFastTurns(Double numFastTurns) { + this.numFastTurns = Optional.ofNullable(numFastTurns); + return this; + } + + @java.lang.Override + @JsonSetter(value = "numFastTurns", nulls = Nulls.SKIP) + public _FinalStage numFastTurns(Optional numFastTurns) { + this.numFastTurns = numFastTurns; + return this; + } + + /** + *

This determines whether we detect user's emotion while they speak and send it as an additional info to model.

+ *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = Optional.ofNullable(emotionRecognitionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "emotionRecognitionEnabled", nulls = Nulls.SKIP) + public _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + return this; + } + + /** + *

This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxTokens(Double maxTokens) { + this.maxTokens = Optional.ofNullable(maxTokens); + return this; + } + + @java.lang.Override + @JsonSetter(value = "maxTokens", nulls = Nulls.SKIP) + public _FinalStage maxTokens(Optional maxTokens) { + this.maxTokens = maxTokens; + return this; + } + + /** + *

These are the options for the knowledge base.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage knowledgeBase(KnowledgeBase knowledgeBase) { + this.knowledgeBase = Optional.ofNullable(knowledgeBase); + return this; + } + + @java.lang.Override + @JsonSetter(value = "knowledgeBase", nulls = Nulls.SKIP) + public _FinalStage knowledgeBase(Optional knowledgeBase) { + this.knowledgeBase = knowledgeBase; + return this; + } + + /** + *

This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage temperature(Double temperature) { + this.temperature = Optional.ofNullable(temperature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "temperature", nulls = Nulls.SKIP) + public _FinalStage temperature(Optional temperature) { + this.temperature = temperature; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use transient tools, use tools.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toolIds(List toolIds) { + this.toolIds = Optional.ofNullable(toolIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "toolIds", nulls = Nulls.SKIP) + public _FinalStage toolIds(Optional> toolIds) { + this.toolIds = toolIds; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use existing tools, use toolIds.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tools(List tools) { + this.tools = Optional.ofNullable(tools); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tools", nulls = Nulls.SKIP) + public _FinalStage tools(Optional> tools) { + this.tools = tools; + return this; + } + + /** + *

This is the starting state for the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + @java.lang.Override + public DeepInfraModel build() { + return new DeepInfraModel( + messages, + tools, + toolIds, + model, + temperature, + knowledgeBase, + maxTokens, + emotionRecognitionEnabled, + numFastTurns, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/DeepInfraModelToolsItem.java b/src/main/java/com/vapi/api/types/DeepInfraModelToolsItem.java new file mode 100644 index 0000000..9777abd --- /dev/null +++ b/src/main/java/com/vapi/api/types/DeepInfraModelToolsItem.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class DeepInfraModelToolsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private DeepInfraModelToolsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static DeepInfraModelToolsItem dtmf(CreateDtmfToolDto value) { + return new DeepInfraModelToolsItem(new DtmfValue(value)); + } + + public static DeepInfraModelToolsItem endCall(CreateEndCallToolDto value) { + return new DeepInfraModelToolsItem(new EndCallValue(value)); + } + + public static DeepInfraModelToolsItem voicemail(CreateVoicemailToolDto value) { + return new DeepInfraModelToolsItem(new VoicemailValue(value)); + } + + public static DeepInfraModelToolsItem function(CreateFunctionToolDto value) { + return new DeepInfraModelToolsItem(new FunctionValue(value)); + } + + public static DeepInfraModelToolsItem ghl(CreateGhlToolDto value) { + return new DeepInfraModelToolsItem(new GhlValue(value)); + } + + public static DeepInfraModelToolsItem make(CreateMakeToolDto value) { + return new DeepInfraModelToolsItem(new MakeValue(value)); + } + + public static DeepInfraModelToolsItem transferCall(CreateTransferCallToolDto value) { + return new DeepInfraModelToolsItem(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DeepInfraModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DeepInfraModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DeepInfraModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DeepInfraModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DeepInfraModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DeepInfraModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DeepInfraModelToolsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "DeepInfraModelToolsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/DeepgramCredential.java b/src/main/java/com/vapi/api/types/DeepgramCredential.java new file mode 100644 index 0000000..62fbe36 --- /dev/null +++ b/src/main/java/com/vapi/api/types/DeepgramCredential.java @@ -0,0 +1,281 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeepgramCredential.Builder.class) +public final class DeepgramCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional apiUrl; + + private final Map additionalProperties; + + private DeepgramCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional apiUrl, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.apiUrl = apiUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "deepgram"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This can be used to point to an onprem Deepgram instance. Defaults to api.deepgram.com. + */ + @JsonProperty("apiUrl") + public Optional getApiUrl() { + return apiUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepgramCredential && equalTo((DeepgramCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeepgramCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && apiUrl.equals(other.apiUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt, this.apiUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(DeepgramCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + DeepgramCredential build(); + + _FinalStage apiUrl(Optional apiUrl); + + _FinalStage apiUrl(String apiUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional apiUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeepgramCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + apiUrl(other.getApiUrl()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This can be used to point to an onprem Deepgram instance. Defaults to api.deepgram.com.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiUrl(String apiUrl) { + this.apiUrl = Optional.ofNullable(apiUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "apiUrl", nulls = Nulls.SKIP) + public _FinalStage apiUrl(Optional apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + @java.lang.Override + public DeepgramCredential build() { + return new DeepgramCredential(apiKey, id, orgId, createdAt, updatedAt, apiUrl, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/DeepgramTranscriber.java b/src/main/java/com/vapi/api/types/DeepgramTranscriber.java new file mode 100644 index 0000000..0aa6d11 --- /dev/null +++ b/src/main/java/com/vapi/api/types/DeepgramTranscriber.java @@ -0,0 +1,256 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeepgramTranscriber.Builder.class) +public final class DeepgramTranscriber { + private final Optional model; + + private final Optional language; + + private final Optional smartFormat; + + private final Optional languageDetectionEnabled; + + private final Optional> keywords; + + private final Optional endpointing; + + private final Map additionalProperties; + + private DeepgramTranscriber( + Optional model, + Optional language, + Optional smartFormat, + Optional languageDetectionEnabled, + Optional> keywords, + Optional endpointing, + Map additionalProperties) { + this.model = model; + this.language = language; + this.smartFormat = smartFormat; + this.languageDetectionEnabled = languageDetectionEnabled; + this.keywords = keywords; + this.endpointing = endpointing; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the Deepgram model that will be used. A list of models can be found here: https://developers.deepgram.com/docs/models-languages-overview + */ + @JsonProperty("model") + public Optional getModel() { + return model; + } + + /** + * @return This is the language that will be set for the transcription. The list of languages Deepgram supports can be found here: https://developers.deepgram.com/docs/models-languages-overview + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + /** + * @return This will be use smart format option provided by Deepgram. It's default disabled because it can sometimes format numbers as times but it's getting better. + */ + @JsonProperty("smartFormat") + public Optional getSmartFormat() { + return smartFormat; + } + + /** + * @return This enables or disables language detection. If true, swaps transcribers to detected language automatically. Defaults to false. + */ + @JsonProperty("languageDetectionEnabled") + public Optional getLanguageDetectionEnabled() { + return languageDetectionEnabled; + } + + /** + * @return These keywords are passed to the transcription model to help it pick up use-case specific words. Anything that may not be a common word, like your company name, should be added here. + */ + @JsonProperty("keywords") + public Optional> getKeywords() { + return keywords; + } + + /** + * @return This is the timeout after which Deepgram will send transcription on user silence. You can read in-depth documentation here: https://developers.deepgram.com/docs/endpointing. + *

Here are the most important bits:

+ *
    + *
  • Defaults to 10. This is recommended for most use cases to optimize for latency.
  • + *
  • 10 can cause some missing transcriptions since because of the shorter context. This mostly happens for one-word utterances. For those uses cases, it's recommended to try 300. It will add a bit of latency but the quality and reliability of the experience will be better.
  • + *
  • If neither 10 nor 300 work, contact support@vapi.ai and we'll find another solution.
  • + *
+ *

@default 10

+ */ + @JsonProperty("endpointing") + public Optional getEndpointing() { + return endpointing; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepgramTranscriber && equalTo((DeepgramTranscriber) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeepgramTranscriber other) { + return model.equals(other.model) + && language.equals(other.language) + && smartFormat.equals(other.smartFormat) + && languageDetectionEnabled.equals(other.languageDetectionEnabled) + && keywords.equals(other.keywords) + && endpointing.equals(other.endpointing); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.model, + this.language, + this.smartFormat, + this.languageDetectionEnabled, + this.keywords, + this.endpointing); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional model = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional smartFormat = Optional.empty(); + + private Optional languageDetectionEnabled = Optional.empty(); + + private Optional> keywords = Optional.empty(); + + private Optional endpointing = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeepgramTranscriber other) { + model(other.getModel()); + language(other.getLanguage()); + smartFormat(other.getSmartFormat()); + languageDetectionEnabled(other.getLanguageDetectionEnabled()); + keywords(other.getKeywords()); + endpointing(other.getEndpointing()); + return this; + } + + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public Builder model(Optional model) { + this.model = model; + return this; + } + + public Builder model(DeepgramTranscriberModel model) { + this.model = Optional.ofNullable(model); + return this; + } + + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public Builder language(Optional language) { + this.language = language; + return this; + } + + public Builder language(DeepgramTranscriberLanguage language) { + this.language = Optional.ofNullable(language); + return this; + } + + @JsonSetter(value = "smartFormat", nulls = Nulls.SKIP) + public Builder smartFormat(Optional smartFormat) { + this.smartFormat = smartFormat; + return this; + } + + public Builder smartFormat(Boolean smartFormat) { + this.smartFormat = Optional.ofNullable(smartFormat); + return this; + } + + @JsonSetter(value = "languageDetectionEnabled", nulls = Nulls.SKIP) + public Builder languageDetectionEnabled(Optional languageDetectionEnabled) { + this.languageDetectionEnabled = languageDetectionEnabled; + return this; + } + + public Builder languageDetectionEnabled(Boolean languageDetectionEnabled) { + this.languageDetectionEnabled = Optional.ofNullable(languageDetectionEnabled); + return this; + } + + @JsonSetter(value = "keywords", nulls = Nulls.SKIP) + public Builder keywords(Optional> keywords) { + this.keywords = keywords; + return this; + } + + public Builder keywords(List keywords) { + this.keywords = Optional.ofNullable(keywords); + return this; + } + + @JsonSetter(value = "endpointing", nulls = Nulls.SKIP) + public Builder endpointing(Optional endpointing) { + this.endpointing = endpointing; + return this; + } + + public Builder endpointing(Double endpointing) { + this.endpointing = Optional.ofNullable(endpointing); + return this; + } + + public DeepgramTranscriber build() { + return new DeepgramTranscriber( + model, + language, + smartFormat, + languageDetectionEnabled, + keywords, + endpointing, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/DeepgramTranscriberLanguage.java b/src/main/java/com/vapi/api/types/DeepgramTranscriberLanguage.java new file mode 100644 index 0000000..d86ff0b --- /dev/null +++ b/src/main/java/com/vapi/api/types/DeepgramTranscriberLanguage.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum DeepgramTranscriberLanguage { + BG("bg"), + + CA("ca"), + + CS("cs"), + + DA("da"), + + DA_DK("da-DK"), + + DE("de"), + + DE_CH("de-CH"), + + EL("el"), + + EN("en"), + + EN_AU("en-AU"), + + EN_GB("en-GB"), + + EN_IN("en-IN"), + + EN_NZ("en-NZ"), + + EN_US("en-US"), + + ES("es"), + + ES_419("es-419"), + + ES_LATAM("es-LATAM"), + + ET("et"), + + FI("fi"), + + FR("fr"), + + FR_CA("fr-CA"), + + HI("hi"), + + HI_LATN("hi-Latn"), + + HU("hu"), + + ID("id"), + + IT("it"), + + JA("ja"), + + KO("ko"), + + KO_KR("ko-KR"), + + LT("lt"), + + LV("lv"), + + MS("ms"), + + MULTI("multi"), + + NL("nl"), + + NL_BE("nl-BE"), + + NO("no"), + + PL("pl"), + + PT("pt"), + + PT_BR("pt-BR"), + + RO("ro"), + + RU("ru"), + + SK("sk"), + + SV("sv"), + + SV_SE("sv-SE"), + + TA("ta"), + + TAQ("taq"), + + TH("th"), + + TH_TH("th-TH"), + + TR("tr"), + + UK("uk"), + + VI("vi"), + + ZH("zh"), + + ZH_CN("zh-CN"), + + ZH_HANS("zh-Hans"), + + ZH_HANT("zh-Hant"), + + ZH_TW("zh-TW"); + + private final String value; + + DeepgramTranscriberLanguage(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/DeepgramTranscriberModel.java b/src/main/java/com/vapi/api/types/DeepgramTranscriberModel.java new file mode 100644 index 0000000..a3cc129 --- /dev/null +++ b/src/main/java/com/vapi/api/types/DeepgramTranscriberModel.java @@ -0,0 +1,76 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum DeepgramTranscriberModel { + NOVA_2("nova-2"), + + NOVA_2_GENERAL("nova-2-general"), + + NOVA_2_MEETING("nova-2-meeting"), + + NOVA_2_PHONECALL("nova-2-phonecall"), + + NOVA_2_FINANCE("nova-2-finance"), + + NOVA_2_CONVERSATIONALAI("nova-2-conversationalai"), + + NOVA_2_VOICEMAIL("nova-2-voicemail"), + + NOVA_2_VIDEO("nova-2-video"), + + NOVA_2_MEDICAL("nova-2-medical"), + + NOVA_2_DRIVETHRU("nova-2-drivethru"), + + NOVA_2_AUTOMOTIVE("nova-2-automotive"), + + NOVA("nova"), + + NOVA_GENERAL("nova-general"), + + NOVA_PHONECALL("nova-phonecall"), + + NOVA_MEDICAL("nova-medical"), + + ENHANCED("enhanced"), + + ENHANCED_GENERAL("enhanced-general"), + + ENHANCED_MEETING("enhanced-meeting"), + + ENHANCED_PHONECALL("enhanced-phonecall"), + + ENHANCED_FINANCE("enhanced-finance"), + + BASE("base"), + + BASE_GENERAL("base-general"), + + BASE_MEETING("base-meeting"), + + BASE_PHONECALL("base-phonecall"), + + BASE_FINANCE("base-finance"), + + BASE_CONVERSATIONALAI("base-conversationalai"), + + BASE_VOICEMAIL("base-voicemail"), + + BASE_VIDEO("base-video"); + + private final String value; + + DeepgramTranscriberModel(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/DeepgramVoice.java b/src/main/java/com/vapi/api/types/DeepgramVoice.java new file mode 100644 index 0000000..ecbcc03 --- /dev/null +++ b/src/main/java/com/vapi/api/types/DeepgramVoice.java @@ -0,0 +1,189 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeepgramVoice.Builder.class) +public final class DeepgramVoice { + private final Optional fillerInjectionEnabled; + + private final DeepgramVoiceId voiceId; + + private final Optional chunkPlan; + + private final Map additionalProperties; + + private DeepgramVoice( + Optional fillerInjectionEnabled, + DeepgramVoiceId voiceId, + Optional chunkPlan, + Map additionalProperties) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + this.voiceId = voiceId; + this.chunkPlan = chunkPlan; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines whether fillers are injected into the model output before inputting it into the voice provider. + *

Default false because you can achieve better results with prompting the model.

+ */ + @JsonProperty("fillerInjectionEnabled") + public Optional getFillerInjectionEnabled() { + return fillerInjectionEnabled; + } + + /** + * @return This is the provider-specific ID that will be used. + */ + @JsonProperty("voiceId") + public DeepgramVoiceId getVoiceId() { + return voiceId; + } + + /** + * @return This is the plan for chunking the model output before it is sent to the voice provider. + */ + @JsonProperty("chunkPlan") + public Optional getChunkPlan() { + return chunkPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepgramVoice && equalTo((DeepgramVoice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeepgramVoice other) { + return fillerInjectionEnabled.equals(other.fillerInjectionEnabled) + && voiceId.equals(other.voiceId) + && chunkPlan.equals(other.chunkPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fillerInjectionEnabled, this.voiceId, this.chunkPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VoiceIdStage builder() { + return new Builder(); + } + + public interface VoiceIdStage { + _FinalStage voiceId(@NotNull DeepgramVoiceId voiceId); + + Builder from(DeepgramVoice other); + } + + public interface _FinalStage { + DeepgramVoice build(); + + _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled); + + _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled); + + _FinalStage chunkPlan(Optional chunkPlan); + + _FinalStage chunkPlan(ChunkPlan chunkPlan); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VoiceIdStage, _FinalStage { + private DeepgramVoiceId voiceId; + + private Optional chunkPlan = Optional.empty(); + + private Optional fillerInjectionEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeepgramVoice other) { + fillerInjectionEnabled(other.getFillerInjectionEnabled()); + voiceId(other.getVoiceId()); + chunkPlan(other.getChunkPlan()); + return this; + } + + /** + *

This is the provider-specific ID that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("voiceId") + public _FinalStage voiceId(@NotNull DeepgramVoiceId voiceId) { + this.voiceId = Objects.requireNonNull(voiceId, "voiceId must not be null"); + return this; + } + + /** + *

This is the plan for chunking the model output before it is sent to the voice provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage chunkPlan(ChunkPlan chunkPlan) { + this.chunkPlan = Optional.ofNullable(chunkPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "chunkPlan", nulls = Nulls.SKIP) + public _FinalStage chunkPlan(Optional chunkPlan) { + this.chunkPlan = chunkPlan; + return this; + } + + /** + *

This determines whether fillers are injected into the model output before inputting it into the voice provider.

+ *

Default false because you can achieve better results with prompting the model.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled) { + this.fillerInjectionEnabled = Optional.ofNullable(fillerInjectionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fillerInjectionEnabled", nulls = Nulls.SKIP) + public _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + return this; + } + + @java.lang.Override + public DeepgramVoice build() { + return new DeepgramVoice(fillerInjectionEnabled, voiceId, chunkPlan, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/DeepgramVoiceId.java b/src/main/java/com/vapi/api/types/DeepgramVoiceId.java new file mode 100644 index 0000000..15ce666 --- /dev/null +++ b/src/main/java/com/vapi/api/types/DeepgramVoiceId.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.vapi.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = DeepgramVoiceId.Deserializer.class) +public final class DeepgramVoiceId { + private final Object value; + + private final int type; + + private DeepgramVoiceId(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((DeepgramVoiceIdEnum) this.value); + } else if (this.type == 1) { + return visitor.visit((String) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeepgramVoiceId && equalTo((DeepgramVoiceId) other); + } + + private boolean equalTo(DeepgramVoiceId other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static DeepgramVoiceId of(DeepgramVoiceIdEnum value) { + return new DeepgramVoiceId(value, 0); + } + + public static DeepgramVoiceId of(String value) { + return new DeepgramVoiceId(value, 1); + } + + public interface Visitor { + T visit(DeepgramVoiceIdEnum value); + + T visit(String value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(DeepgramVoiceId.class); + } + + @java.lang.Override + public DeepgramVoiceId deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, DeepgramVoiceIdEnum.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (IllegalArgumentException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/vapi/api/types/DeepgramVoiceIdEnum.java b/src/main/java/com/vapi/api/types/DeepgramVoiceIdEnum.java new file mode 100644 index 0000000..0f82c58 --- /dev/null +++ b/src/main/java/com/vapi/api/types/DeepgramVoiceIdEnum.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum DeepgramVoiceIdEnum { + ASTERIA("asteria"), + + LUNA("luna"), + + STELLA("stella"), + + ATHENA("athena"), + + HERA("hera"), + + ORION("orion"), + + ARCAS("arcas"), + + PERSEUS("perseus"), + + ANGUS("angus"), + + ORPHEUS("orpheus"), + + HELIOS("helios"), + + ZEUS("zeus"); + + private final String value; + + DeepgramVoiceIdEnum(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/DtmfTool.java b/src/main/java/com/vapi/api/types/DtmfTool.java new file mode 100644 index 0000000..715f3e6 --- /dev/null +++ b/src/main/java/com/vapi/api/types/DtmfTool.java @@ -0,0 +1,381 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DtmfTool.Builder.class) +public final class DtmfTool { + private final Optional async; + + private final Optional> messages; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private DtmfTool( + Optional async, + Optional> messages, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the unique identifier for the tool. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the organization that this tool belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the tool was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the tool was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfTool && equalTo((DtmfTool) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DtmfTool other) { + return async.equals(other.async) + && messages.equals(other.messages) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.async, + this.messages, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.function, + this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(DtmfTool other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + DtmfTool build(); + + _FinalStage async(Optional async); + + _FinalStage async(Boolean async); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage function(Optional function); + + _FinalStage function(OpenAiFunction function); + + _FinalStage server(Optional server); + + _FinalStage server(Server server); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional server = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional async = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DtmfTool other) { + async(other.getAsync()); + messages(other.getMessages()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + /** + *

This is the unique identifier for the tool.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the organization that this tool belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the tool was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the tool was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the server that will be hit when this tool is requested by the model.

+ *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + @java.lang.Override + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public _FinalStage server(Optional server) { + this.server = server; + return this; + } + + /** + *

This is the function definition of the tool.

+ *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @java.lang.Override + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public _FinalStage function(Optional function) { + this.function = function; + return this; + } + + /** + *

These are the messages that will be spoken to the user as the tool is running.

+ *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + /** + *

This determines if the tool is async.

+ *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @java.lang.Override + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public _FinalStage async(Optional async) { + this.async = async; + return this; + } + + @java.lang.Override + public DtmfTool build() { + return new DtmfTool( + async, messages, id, orgId, createdAt, updatedAt, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/DtmfToolMessagesItem.java b/src/main/java/com/vapi/api/types/DtmfToolMessagesItem.java new file mode 100644 index 0000000..3450935 --- /dev/null +++ b/src/main/java/com/vapi/api/types/DtmfToolMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class DtmfToolMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private DtmfToolMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static DtmfToolMessagesItem requestStart(ToolMessageStart value) { + return new DtmfToolMessagesItem(new RequestStartValue(value)); + } + + public static DtmfToolMessagesItem requestComplete(ToolMessageComplete value) { + return new DtmfToolMessagesItem(new RequestCompleteValue(value)); + } + + public static DtmfToolMessagesItem requestFailed(ToolMessageFailed value) { + return new DtmfToolMessagesItem(new RequestFailedValue(value)); + } + + public static DtmfToolMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new DtmfToolMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DtmfToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DtmfToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DtmfToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "DtmfToolMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "DtmfToolMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ElevenLabsCredential.java b/src/main/java/com/vapi/api/types/ElevenLabsCredential.java new file mode 100644 index 0000000..629ddc9 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ElevenLabsCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ElevenLabsCredential.Builder.class) +public final class ElevenLabsCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private ElevenLabsCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "11labs"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ElevenLabsCredential && equalTo((ElevenLabsCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ElevenLabsCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(ElevenLabsCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + ElevenLabsCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ElevenLabsCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public ElevenLabsCredential build() { + return new ElevenLabsCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ElevenLabsVoice.java b/src/main/java/com/vapi/api/types/ElevenLabsVoice.java new file mode 100644 index 0000000..7998c60 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ElevenLabsVoice.java @@ -0,0 +1,510 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ElevenLabsVoice.Builder.class) +public final class ElevenLabsVoice { + private final Optional fillerInjectionEnabled; + + private final ElevenLabsVoiceId voiceId; + + private final Optional stability; + + private final Optional similarityBoost; + + private final Optional style; + + private final Optional useSpeakerBoost; + + private final Optional optimizeStreamingLatency; + + private final Optional enableSsmlParsing; + + private final Optional model; + + private final Optional language; + + private final Optional chunkPlan; + + private final Map additionalProperties; + + private ElevenLabsVoice( + Optional fillerInjectionEnabled, + ElevenLabsVoiceId voiceId, + Optional stability, + Optional similarityBoost, + Optional style, + Optional useSpeakerBoost, + Optional optimizeStreamingLatency, + Optional enableSsmlParsing, + Optional model, + Optional language, + Optional chunkPlan, + Map additionalProperties) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + this.voiceId = voiceId; + this.stability = stability; + this.similarityBoost = similarityBoost; + this.style = style; + this.useSpeakerBoost = useSpeakerBoost; + this.optimizeStreamingLatency = optimizeStreamingLatency; + this.enableSsmlParsing = enableSsmlParsing; + this.model = model; + this.language = language; + this.chunkPlan = chunkPlan; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines whether fillers are injected into the model output before inputting it into the voice provider. + *

Default false because you can achieve better results with prompting the model.

+ */ + @JsonProperty("fillerInjectionEnabled") + public Optional getFillerInjectionEnabled() { + return fillerInjectionEnabled; + } + + /** + * @return This is the provider-specific ID that will be used. Ensure the Voice is present in your 11Labs Voice Library. + */ + @JsonProperty("voiceId") + public ElevenLabsVoiceId getVoiceId() { + return voiceId; + } + + /** + * @return Defines the stability for voice settings. + */ + @JsonProperty("stability") + public Optional getStability() { + return stability; + } + + /** + * @return Defines the similarity boost for voice settings. + */ + @JsonProperty("similarityBoost") + public Optional getSimilarityBoost() { + return similarityBoost; + } + + /** + * @return Defines the style for voice settings. + */ + @JsonProperty("style") + public Optional getStyle() { + return style; + } + + /** + * @return Defines the use speaker boost for voice settings. + */ + @JsonProperty("useSpeakerBoost") + public Optional getUseSpeakerBoost() { + return useSpeakerBoost; + } + + /** + * @return Defines the optimize streaming latency for voice settings. Defaults to 3. + */ + @JsonProperty("optimizeStreamingLatency") + public Optional getOptimizeStreamingLatency() { + return optimizeStreamingLatency; + } + + /** + * @return This enables the use of https://elevenlabs.io/docs/speech-synthesis/prompting#pronunciation. Defaults to false to save latency. + *

@default false

+ */ + @JsonProperty("enableSsmlParsing") + public Optional getEnableSsmlParsing() { + return enableSsmlParsing; + } + + /** + * @return This is the model that will be used. Defaults to 'eleven_turbo_v2' if not specified. + */ + @JsonProperty("model") + public Optional getModel() { + return model; + } + + /** + * @return This is the language (ISO 639-1) that is enforced for the model. Currently only Turbo v2.5 supports language enforcement. For other models, an error will be returned if language code is provided. + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + /** + * @return This is the plan for chunking the model output before it is sent to the voice provider. + */ + @JsonProperty("chunkPlan") + public Optional getChunkPlan() { + return chunkPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ElevenLabsVoice && equalTo((ElevenLabsVoice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ElevenLabsVoice other) { + return fillerInjectionEnabled.equals(other.fillerInjectionEnabled) + && voiceId.equals(other.voiceId) + && stability.equals(other.stability) + && similarityBoost.equals(other.similarityBoost) + && style.equals(other.style) + && useSpeakerBoost.equals(other.useSpeakerBoost) + && optimizeStreamingLatency.equals(other.optimizeStreamingLatency) + && enableSsmlParsing.equals(other.enableSsmlParsing) + && model.equals(other.model) + && language.equals(other.language) + && chunkPlan.equals(other.chunkPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fillerInjectionEnabled, + this.voiceId, + this.stability, + this.similarityBoost, + this.style, + this.useSpeakerBoost, + this.optimizeStreamingLatency, + this.enableSsmlParsing, + this.model, + this.language, + this.chunkPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VoiceIdStage builder() { + return new Builder(); + } + + public interface VoiceIdStage { + _FinalStage voiceId(@NotNull ElevenLabsVoiceId voiceId); + + Builder from(ElevenLabsVoice other); + } + + public interface _FinalStage { + ElevenLabsVoice build(); + + _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled); + + _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled); + + _FinalStage stability(Optional stability); + + _FinalStage stability(Double stability); + + _FinalStage similarityBoost(Optional similarityBoost); + + _FinalStage similarityBoost(Double similarityBoost); + + _FinalStage style(Optional style); + + _FinalStage style(Double style); + + _FinalStage useSpeakerBoost(Optional useSpeakerBoost); + + _FinalStage useSpeakerBoost(Boolean useSpeakerBoost); + + _FinalStage optimizeStreamingLatency(Optional optimizeStreamingLatency); + + _FinalStage optimizeStreamingLatency(Double optimizeStreamingLatency); + + _FinalStage enableSsmlParsing(Optional enableSsmlParsing); + + _FinalStage enableSsmlParsing(Boolean enableSsmlParsing); + + _FinalStage model(Optional model); + + _FinalStage model(ElevenLabsVoiceModel model); + + _FinalStage language(Optional language); + + _FinalStage language(String language); + + _FinalStage chunkPlan(Optional chunkPlan); + + _FinalStage chunkPlan(ChunkPlan chunkPlan); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VoiceIdStage, _FinalStage { + private ElevenLabsVoiceId voiceId; + + private Optional chunkPlan = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional model = Optional.empty(); + + private Optional enableSsmlParsing = Optional.empty(); + + private Optional optimizeStreamingLatency = Optional.empty(); + + private Optional useSpeakerBoost = Optional.empty(); + + private Optional style = Optional.empty(); + + private Optional similarityBoost = Optional.empty(); + + private Optional stability = Optional.empty(); + + private Optional fillerInjectionEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ElevenLabsVoice other) { + fillerInjectionEnabled(other.getFillerInjectionEnabled()); + voiceId(other.getVoiceId()); + stability(other.getStability()); + similarityBoost(other.getSimilarityBoost()); + style(other.getStyle()); + useSpeakerBoost(other.getUseSpeakerBoost()); + optimizeStreamingLatency(other.getOptimizeStreamingLatency()); + enableSsmlParsing(other.getEnableSsmlParsing()); + model(other.getModel()); + language(other.getLanguage()); + chunkPlan(other.getChunkPlan()); + return this; + } + + /** + *

This is the provider-specific ID that will be used. Ensure the Voice is present in your 11Labs Voice Library.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("voiceId") + public _FinalStage voiceId(@NotNull ElevenLabsVoiceId voiceId) { + this.voiceId = Objects.requireNonNull(voiceId, "voiceId must not be null"); + return this; + } + + /** + *

This is the plan for chunking the model output before it is sent to the voice provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage chunkPlan(ChunkPlan chunkPlan) { + this.chunkPlan = Optional.ofNullable(chunkPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "chunkPlan", nulls = Nulls.SKIP) + public _FinalStage chunkPlan(Optional chunkPlan) { + this.chunkPlan = chunkPlan; + return this; + } + + /** + *

This is the language (ISO 639-1) that is enforced for the model. Currently only Turbo v2.5 supports language enforcement. For other models, an error will be returned if language code is provided.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage language(String language) { + this.language = Optional.ofNullable(language); + return this; + } + + @java.lang.Override + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public _FinalStage language(Optional language) { + this.language = language; + return this; + } + + /** + *

This is the model that will be used. Defaults to 'eleven_turbo_v2' if not specified.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage model(ElevenLabsVoiceModel model) { + this.model = Optional.ofNullable(model); + return this; + } + + @java.lang.Override + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public _FinalStage model(Optional model) { + this.model = model; + return this; + } + + /** + *

This enables the use of https://elevenlabs.io/docs/speech-synthesis/prompting#pronunciation. Defaults to false to save latency.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage enableSsmlParsing(Boolean enableSsmlParsing) { + this.enableSsmlParsing = Optional.ofNullable(enableSsmlParsing); + return this; + } + + @java.lang.Override + @JsonSetter(value = "enableSsmlParsing", nulls = Nulls.SKIP) + public _FinalStage enableSsmlParsing(Optional enableSsmlParsing) { + this.enableSsmlParsing = enableSsmlParsing; + return this; + } + + /** + *

Defines the optimize streaming latency for voice settings. Defaults to 3.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optimizeStreamingLatency(Double optimizeStreamingLatency) { + this.optimizeStreamingLatency = Optional.ofNullable(optimizeStreamingLatency); + return this; + } + + @java.lang.Override + @JsonSetter(value = "optimizeStreamingLatency", nulls = Nulls.SKIP) + public _FinalStage optimizeStreamingLatency(Optional optimizeStreamingLatency) { + this.optimizeStreamingLatency = optimizeStreamingLatency; + return this; + } + + /** + *

Defines the use speaker boost for voice settings.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage useSpeakerBoost(Boolean useSpeakerBoost) { + this.useSpeakerBoost = Optional.ofNullable(useSpeakerBoost); + return this; + } + + @java.lang.Override + @JsonSetter(value = "useSpeakerBoost", nulls = Nulls.SKIP) + public _FinalStage useSpeakerBoost(Optional useSpeakerBoost) { + this.useSpeakerBoost = useSpeakerBoost; + return this; + } + + /** + *

Defines the style for voice settings.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage style(Double style) { + this.style = Optional.ofNullable(style); + return this; + } + + @java.lang.Override + @JsonSetter(value = "style", nulls = Nulls.SKIP) + public _FinalStage style(Optional style) { + this.style = style; + return this; + } + + /** + *

Defines the similarity boost for voice settings.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage similarityBoost(Double similarityBoost) { + this.similarityBoost = Optional.ofNullable(similarityBoost); + return this; + } + + @java.lang.Override + @JsonSetter(value = "similarityBoost", nulls = Nulls.SKIP) + public _FinalStage similarityBoost(Optional similarityBoost) { + this.similarityBoost = similarityBoost; + return this; + } + + /** + *

Defines the stability for voice settings.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage stability(Double stability) { + this.stability = Optional.ofNullable(stability); + return this; + } + + @java.lang.Override + @JsonSetter(value = "stability", nulls = Nulls.SKIP) + public _FinalStage stability(Optional stability) { + this.stability = stability; + return this; + } + + /** + *

This determines whether fillers are injected into the model output before inputting it into the voice provider.

+ *

Default false because you can achieve better results with prompting the model.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled) { + this.fillerInjectionEnabled = Optional.ofNullable(fillerInjectionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fillerInjectionEnabled", nulls = Nulls.SKIP) + public _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + return this; + } + + @java.lang.Override + public ElevenLabsVoice build() { + return new ElevenLabsVoice( + fillerInjectionEnabled, + voiceId, + stability, + similarityBoost, + style, + useSpeakerBoost, + optimizeStreamingLatency, + enableSsmlParsing, + model, + language, + chunkPlan, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ElevenLabsVoiceId.java b/src/main/java/com/vapi/api/types/ElevenLabsVoiceId.java new file mode 100644 index 0000000..8d066d7 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ElevenLabsVoiceId.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.vapi.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = ElevenLabsVoiceId.Deserializer.class) +public final class ElevenLabsVoiceId { + private final Object value; + + private final int type; + + private ElevenLabsVoiceId(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((ElevenLabsVoiceIdEnum) this.value); + } else if (this.type == 1) { + return visitor.visit((String) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ElevenLabsVoiceId && equalTo((ElevenLabsVoiceId) other); + } + + private boolean equalTo(ElevenLabsVoiceId other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static ElevenLabsVoiceId of(ElevenLabsVoiceIdEnum value) { + return new ElevenLabsVoiceId(value, 0); + } + + public static ElevenLabsVoiceId of(String value) { + return new ElevenLabsVoiceId(value, 1); + } + + public interface Visitor { + T visit(ElevenLabsVoiceIdEnum value); + + T visit(String value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(ElevenLabsVoiceId.class); + } + + @java.lang.Override + public ElevenLabsVoiceId deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ElevenLabsVoiceIdEnum.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (IllegalArgumentException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ElevenLabsVoiceIdEnum.java b/src/main/java/com/vapi/api/types/ElevenLabsVoiceIdEnum.java new file mode 100644 index 0000000..8bd7533 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ElevenLabsVoiceIdEnum.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ElevenLabsVoiceIdEnum { + BURT("burt"), + + MARISSA("marissa"), + + ANDREA("andrea"), + + SARAH("sarah"), + + PHILLIP("phillip"), + + STEVE("steve"), + + JOSEPH("joseph"), + + MYRA("myra"), + + PAULA("paula"), + + RYAN("ryan"), + + DREW("drew"), + + PAUL("paul"), + + MRB("mrb"), + + MATILDA("matilda"), + + MARK("mark"); + + private final String value; + + ElevenLabsVoiceIdEnum(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ElevenLabsVoiceModel.java b/src/main/java/com/vapi/api/types/ElevenLabsVoiceModel.java new file mode 100644 index 0000000..91eb35e --- /dev/null +++ b/src/main/java/com/vapi/api/types/ElevenLabsVoiceModel.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ElevenLabsVoiceModel { + ELEVEN_MULTILINGUAL_V_2("eleven_multilingual_v2"), + + ELEVEN_TURBO_V_2("eleven_turbo_v2"), + + ELEVEN_TURBO_V_2_5("eleven_turbo_v2_5"), + + ELEVEN_MONOLINGUAL_V_1("eleven_monolingual_v1"); + + private final String value; + + ElevenLabsVoiceModel(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/EndCallTool.java b/src/main/java/com/vapi/api/types/EndCallTool.java new file mode 100644 index 0000000..040ba3b --- /dev/null +++ b/src/main/java/com/vapi/api/types/EndCallTool.java @@ -0,0 +1,381 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EndCallTool.Builder.class) +public final class EndCallTool { + private final Optional async; + + private final Optional> messages; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private EndCallTool( + Optional async, + Optional> messages, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the unique identifier for the tool. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the organization that this tool belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the tool was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the tool was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallTool && equalTo((EndCallTool) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EndCallTool other) { + return async.equals(other.async) + && messages.equals(other.messages) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.async, + this.messages, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.function, + this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(EndCallTool other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + EndCallTool build(); + + _FinalStage async(Optional async); + + _FinalStage async(Boolean async); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage function(Optional function); + + _FinalStage function(OpenAiFunction function); + + _FinalStage server(Optional server); + + _FinalStage server(Server server); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional server = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional async = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EndCallTool other) { + async(other.getAsync()); + messages(other.getMessages()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + /** + *

This is the unique identifier for the tool.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the organization that this tool belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the tool was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the tool was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the server that will be hit when this tool is requested by the model.

+ *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + @java.lang.Override + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public _FinalStage server(Optional server) { + this.server = server; + return this; + } + + /** + *

This is the function definition of the tool.

+ *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @java.lang.Override + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public _FinalStage function(Optional function) { + this.function = function; + return this; + } + + /** + *

These are the messages that will be spoken to the user as the tool is running.

+ *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + /** + *

This determines if the tool is async.

+ *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @java.lang.Override + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public _FinalStage async(Optional async) { + this.async = async; + return this; + } + + @java.lang.Override + public EndCallTool build() { + return new EndCallTool( + async, messages, id, orgId, createdAt, updatedAt, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/EndCallToolMessagesItem.java b/src/main/java/com/vapi/api/types/EndCallToolMessagesItem.java new file mode 100644 index 0000000..1a18893 --- /dev/null +++ b/src/main/java/com/vapi/api/types/EndCallToolMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class EndCallToolMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private EndCallToolMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static EndCallToolMessagesItem requestStart(ToolMessageStart value) { + return new EndCallToolMessagesItem(new RequestStartValue(value)); + } + + public static EndCallToolMessagesItem requestComplete(ToolMessageComplete value) { + return new EndCallToolMessagesItem(new RequestCompleteValue(value)); + } + + public static EndCallToolMessagesItem requestFailed(ToolMessageFailed value) { + return new EndCallToolMessagesItem(new RequestFailedValue(value)); + } + + public static EndCallToolMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new EndCallToolMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "EndCallToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "EndCallToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "EndCallToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "EndCallToolMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "EndCallToolMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/Error.java b/src/main/java/com/vapi/api/types/Error.java new file mode 100644 index 0000000..f82efb3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/Error.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Error.Builder.class) +public final class Error { + private final String message; + + private final Map additionalProperties; + + private Error(String message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("message") + public String getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Error && equalTo((Error) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Error other) { + return message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + _FinalStage message(@NotNull String message); + + Builder from(Error other); + } + + public interface _FinalStage { + Error build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, _FinalStage { + private String message; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Error other) { + message(other.getMessage()); + return this; + } + + @java.lang.Override + @JsonSetter("message") + public _FinalStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + public Error build() { + return new Error(message, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ExactReplacement.java b/src/main/java/com/vapi/api/types/ExactReplacement.java new file mode 100644 index 0000000..d43e1e7 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ExactReplacement.java @@ -0,0 +1,138 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ExactReplacement.Builder.class) +public final class ExactReplacement { + private final String key; + + private final String value; + + private final Map additionalProperties; + + private ExactReplacement(String key, String value, Map additionalProperties) { + this.key = key; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the key to replace. + */ + @JsonProperty("key") + public String getKey() { + return key; + } + + /** + * @return This is the value that will replace the match. + */ + @JsonProperty("value") + public String getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExactReplacement && equalTo((ExactReplacement) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ExactReplacement other) { + return key.equals(other.key) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.key, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KeyStage builder() { + return new Builder(); + } + + public interface KeyStage { + ValueStage key(@NotNull String key); + + Builder from(ExactReplacement other); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + } + + public interface _FinalStage { + ExactReplacement build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KeyStage, ValueStage, _FinalStage { + private String key; + + private String value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ExactReplacement other) { + key(other.getKey()); + value(other.getValue()); + return this; + } + + /** + *

This is the key to replace.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("key") + public ValueStage key(@NotNull String key) { + this.key = Objects.requireNonNull(key, "key must not be null"); + return this; + } + + /** + *

This is the value that will replace the match.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + @java.lang.Override + public ExactReplacement build() { + return new ExactReplacement(key, value, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/File.java b/src/main/java/com/vapi/api/types/File.java new file mode 100644 index 0000000..9d6e5fa --- /dev/null +++ b/src/main/java/com/vapi/api/types/File.java @@ -0,0 +1,607 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = File.Builder.class) +public final class File { + private final Optional _object; + + private final Optional status; + + private final Optional name; + + private final Optional originalName; + + private final Optional bytes; + + private final Optional purpose; + + private final Optional mimetype; + + private final Optional key; + + private final Optional path; + + private final Optional bucket; + + private final Optional url; + + private final Optional> metadata; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private File( + Optional _object, + Optional status, + Optional name, + Optional originalName, + Optional bytes, + Optional purpose, + Optional mimetype, + Optional key, + Optional path, + Optional bucket, + Optional url, + Optional> metadata, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this._object = _object; + this.status = status; + this.name = name; + this.originalName = originalName; + this.bytes = bytes; + this.purpose = purpose; + this.mimetype = mimetype; + this.key = key; + this.path = path; + this.bucket = bucket; + this.url = url; + this.metadata = metadata; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("object") + public Optional getObject() { + return _object; + } + + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return This is the name of the file. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("originalName") + public Optional getOriginalName() { + return originalName; + } + + @JsonProperty("bytes") + public Optional getBytes() { + return bytes; + } + + @JsonProperty("purpose") + public Optional getPurpose() { + return purpose; + } + + @JsonProperty("mimetype") + public Optional getMimetype() { + return mimetype; + } + + @JsonProperty("key") + public Optional getKey() { + return key; + } + + @JsonProperty("path") + public Optional getPath() { + return path; + } + + @JsonProperty("bucket") + public Optional getBucket() { + return bucket; + } + + @JsonProperty("url") + public Optional getUrl() { + return url; + } + + @JsonProperty("metadata") + public Optional> getMetadata() { + return metadata; + } + + /** + * @return This is the unique identifier for the file. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this file belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the file was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the file was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof File && equalTo((File) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(File other) { + return _object.equals(other._object) + && status.equals(other.status) + && name.equals(other.name) + && originalName.equals(other.originalName) + && bytes.equals(other.bytes) + && purpose.equals(other.purpose) + && mimetype.equals(other.mimetype) + && key.equals(other.key) + && path.equals(other.path) + && bucket.equals(other.bucket) + && url.equals(other.url) + && metadata.equals(other.metadata) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this._object, + this.status, + this.name, + this.originalName, + this.bytes, + this.purpose, + this.mimetype, + this.key, + this.path, + this.bucket, + this.url, + this.metadata, + this.id, + this.orgId, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(File other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + File build(); + + _FinalStage _object(Optional _object); + + _FinalStage _object(String _object); + + _FinalStage status(Optional status); + + _FinalStage status(FileStatus status); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage originalName(Optional originalName); + + _FinalStage originalName(String originalName); + + _FinalStage bytes(Optional bytes); + + _FinalStage bytes(Double bytes); + + _FinalStage purpose(Optional purpose); + + _FinalStage purpose(String purpose); + + _FinalStage mimetype(Optional mimetype); + + _FinalStage mimetype(String mimetype); + + _FinalStage key(Optional key); + + _FinalStage key(String key); + + _FinalStage path(Optional path); + + _FinalStage path(String path); + + _FinalStage bucket(Optional bucket); + + _FinalStage bucket(String bucket); + + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage metadata(Optional> metadata); + + _FinalStage metadata(Map metadata); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional> metadata = Optional.empty(); + + private Optional url = Optional.empty(); + + private Optional bucket = Optional.empty(); + + private Optional path = Optional.empty(); + + private Optional key = Optional.empty(); + + private Optional mimetype = Optional.empty(); + + private Optional purpose = Optional.empty(); + + private Optional bytes = Optional.empty(); + + private Optional originalName = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional status = Optional.empty(); + + private Optional _object = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(File other) { + _object(other.getObject()); + status(other.getStatus()); + name(other.getName()); + originalName(other.getOriginalName()); + bytes(other.getBytes()); + purpose(other.getPurpose()); + mimetype(other.getMimetype()); + key(other.getKey()); + path(other.getPath()); + bucket(other.getBucket()); + url(other.getUrl()); + metadata(other.getMetadata()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is the unique identifier for the file.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this file belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the file was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the file was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage metadata(Map metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional> metadata) { + this.metadata = metadata; + return this; + } + + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); + return this; + } + + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; + return this; + } + + @java.lang.Override + public _FinalStage bucket(String bucket) { + this.bucket = Optional.ofNullable(bucket); + return this; + } + + @java.lang.Override + @JsonSetter(value = "bucket", nulls = Nulls.SKIP) + public _FinalStage bucket(Optional bucket) { + this.bucket = bucket; + return this; + } + + @java.lang.Override + public _FinalStage path(String path) { + this.path = Optional.ofNullable(path); + return this; + } + + @java.lang.Override + @JsonSetter(value = "path", nulls = Nulls.SKIP) + public _FinalStage path(Optional path) { + this.path = path; + return this; + } + + @java.lang.Override + public _FinalStage key(String key) { + this.key = Optional.ofNullable(key); + return this; + } + + @java.lang.Override + @JsonSetter(value = "key", nulls = Nulls.SKIP) + public _FinalStage key(Optional key) { + this.key = key; + return this; + } + + @java.lang.Override + public _FinalStage mimetype(String mimetype) { + this.mimetype = Optional.ofNullable(mimetype); + return this; + } + + @java.lang.Override + @JsonSetter(value = "mimetype", nulls = Nulls.SKIP) + public _FinalStage mimetype(Optional mimetype) { + this.mimetype = mimetype; + return this; + } + + @java.lang.Override + public _FinalStage purpose(String purpose) { + this.purpose = Optional.ofNullable(purpose); + return this; + } + + @java.lang.Override + @JsonSetter(value = "purpose", nulls = Nulls.SKIP) + public _FinalStage purpose(Optional purpose) { + this.purpose = purpose; + return this; + } + + @java.lang.Override + public _FinalStage bytes(Double bytes) { + this.bytes = Optional.ofNullable(bytes); + return this; + } + + @java.lang.Override + @JsonSetter(value = "bytes", nulls = Nulls.SKIP) + public _FinalStage bytes(Optional bytes) { + this.bytes = bytes; + return this; + } + + @java.lang.Override + public _FinalStage originalName(String originalName) { + this.originalName = Optional.ofNullable(originalName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "originalName", nulls = Nulls.SKIP) + public _FinalStage originalName(Optional originalName) { + this.originalName = originalName; + return this; + } + + /** + *

This is the name of the file. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public _FinalStage status(FileStatus status) { + this.status = Optional.ofNullable(status); + return this; + } + + @java.lang.Override + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public _FinalStage status(Optional status) { + this.status = status; + return this; + } + + @java.lang.Override + public _FinalStage _object(String _object) { + this._object = Optional.ofNullable(_object); + return this; + } + + @java.lang.Override + @JsonSetter(value = "object", nulls = Nulls.SKIP) + public _FinalStage _object(Optional _object) { + this._object = _object; + return this; + } + + @java.lang.Override + public File build() { + return new File( + _object, + status, + name, + originalName, + bytes, + purpose, + mimetype, + key, + path, + bucket, + url, + metadata, + id, + orgId, + createdAt, + updatedAt, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/FileStatus.java b/src/main/java/com/vapi/api/types/FileStatus.java new file mode 100644 index 0000000..a26b659 --- /dev/null +++ b/src/main/java/com/vapi/api/types/FileStatus.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum FileStatus { + INDEXED("indexed"), + + NOT_INDEXED("not_indexed"); + + private final String value; + + FileStatus(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/FormatPlan.java b/src/main/java/com/vapi/api/types/FormatPlan.java new file mode 100644 index 0000000..ec18ee1 --- /dev/null +++ b/src/main/java/com/vapi/api/types/FormatPlan.java @@ -0,0 +1,178 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FormatPlan.Builder.class) +public final class FormatPlan { + private final Optional enabled; + + private final Optional numberToDigitsCutoff; + + private final Optional> replacements; + + private final Map additionalProperties; + + private FormatPlan( + Optional enabled, + Optional numberToDigitsCutoff, + Optional> replacements, + Map additionalProperties) { + this.enabled = enabled; + this.numberToDigitsCutoff = numberToDigitsCutoff; + this.replacements = replacements; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines whether the chunk is formatted before being sent to the voice provider. This helps with enunciation. This includes phone numbers, emails and addresses. Default true. + *

Usage:

+ *
    + *
  • To rely on the voice provider's formatting logic, set this to false.
  • + *
  • To use ElevenLabs's enableSsmlParsing feature, set this to false.
  • + *
+ *

If voice.chunkPlan.enabled is false, this is automatically false since there's no chunk to format.

+ *

@default true

+ */ + @JsonProperty("enabled") + public Optional getEnabled() { + return enabled; + } + + /** + * @return This is the cutoff after which a number is converted to individual digits instead of being spoken as words. + *

Example:

+ *
    + *
  • If cutoff 2025, "12345" is converted to "1 2 3 4 5" while "1200" is converted to "twelve hundred".
  • + *
+ *

Usage:

+ *
    + *
  • If your use case doesn't involve IDs like zip codes, set this to a high value.
  • + *
  • If your use case involves IDs that are shorter than 5 digits, set this to a lower value.
  • + *
+ *

@default 2025

+ */ + @JsonProperty("numberToDigitsCutoff") + public Optional getNumberToDigitsCutoff() { + return numberToDigitsCutoff; + } + + /** + * @return These are the custom replacements you can make to the chunk before it is sent to the voice provider. + *

Usage:

+ *
    + *
  • To replace a specific word or phrase with a different word or phrase, use the ExactReplacement type. Eg. { type: 'exact', key: 'hello', value: 'hi' }
  • + *
  • To replace a word or phrase that matches a pattern, use the RegexReplacement type. Eg. { type: 'regex', regex: '\\b[a-zA-Z]{5}\\b', value: 'hi' }
  • + *
+ *

@default []

+ */ + @JsonProperty("replacements") + public Optional> getReplacements() { + return replacements; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FormatPlan && equalTo((FormatPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FormatPlan other) { + return enabled.equals(other.enabled) + && numberToDigitsCutoff.equals(other.numberToDigitsCutoff) + && replacements.equals(other.replacements); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.enabled, this.numberToDigitsCutoff, this.replacements); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional enabled = Optional.empty(); + + private Optional numberToDigitsCutoff = Optional.empty(); + + private Optional> replacements = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(FormatPlan other) { + enabled(other.getEnabled()); + numberToDigitsCutoff(other.getNumberToDigitsCutoff()); + replacements(other.getReplacements()); + return this; + } + + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(Boolean enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + @JsonSetter(value = "numberToDigitsCutoff", nulls = Nulls.SKIP) + public Builder numberToDigitsCutoff(Optional numberToDigitsCutoff) { + this.numberToDigitsCutoff = numberToDigitsCutoff; + return this; + } + + public Builder numberToDigitsCutoff(Double numberToDigitsCutoff) { + this.numberToDigitsCutoff = Optional.ofNullable(numberToDigitsCutoff); + return this; + } + + @JsonSetter(value = "replacements", nulls = Nulls.SKIP) + public Builder replacements(Optional> replacements) { + this.replacements = replacements; + return this; + } + + public Builder replacements(List replacements) { + this.replacements = Optional.ofNullable(replacements); + return this; + } + + public FormatPlan build() { + return new FormatPlan(enabled, numberToDigitsCutoff, replacements, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/FormatPlanReplacementsItem.java b/src/main/java/com/vapi/api/types/FormatPlanReplacementsItem.java new file mode 100644 index 0000000..f9a498c --- /dev/null +++ b/src/main/java/com/vapi/api/types/FormatPlanReplacementsItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class FormatPlanReplacementsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private FormatPlanReplacementsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static FormatPlanReplacementsItem exact(ExactReplacement value) { + return new FormatPlanReplacementsItem(new ExactValue(value)); + } + + public static FormatPlanReplacementsItem regex(RegexReplacement value) { + return new FormatPlanReplacementsItem(new RegexValue(value)); + } + + public boolean isExact() { + return value instanceof ExactValue; + } + + public boolean isRegex() { + return value instanceof RegexValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getExact() { + if (isExact()) { + return Optional.of(((ExactValue) value).value); + } + return Optional.empty(); + } + + public Optional getRegex() { + if (isRegex()) { + return Optional.of(((RegexValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitExact(ExactReplacement exact); + + T visitRegex(RegexReplacement regex); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(ExactValue.class), @JsonSubTypes.Type(RegexValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("exact") + private static final class ExactValue implements Value { + @JsonUnwrapped + private ExactReplacement value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ExactValue() {} + + private ExactValue(ExactReplacement value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitExact(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ExactValue && equalTo((ExactValue) other); + } + + private boolean equalTo(ExactValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "FormatPlanReplacementsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("regex") + private static final class RegexValue implements Value { + @JsonUnwrapped + private RegexReplacement value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RegexValue() {} + + private RegexValue(RegexReplacement value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRegex(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RegexValue && equalTo((RegexValue) other); + } + + private boolean equalTo(RegexValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "FormatPlanReplacementsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "FormatPlanReplacementsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/FunctionTool.java b/src/main/java/com/vapi/api/types/FunctionTool.java new file mode 100644 index 0000000..3257764 --- /dev/null +++ b/src/main/java/com/vapi/api/types/FunctionTool.java @@ -0,0 +1,381 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FunctionTool.Builder.class) +public final class FunctionTool { + private final Optional async; + + private final Optional> messages; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private FunctionTool( + Optional async, + Optional> messages, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the unique identifier for the tool. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the organization that this tool belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the tool was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the tool was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionTool && equalTo((FunctionTool) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FunctionTool other) { + return async.equals(other.async) + && messages.equals(other.messages) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.async, + this.messages, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.function, + this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(FunctionTool other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + FunctionTool build(); + + _FinalStage async(Optional async); + + _FinalStage async(Boolean async); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage function(Optional function); + + _FinalStage function(OpenAiFunction function); + + _FinalStage server(Optional server); + + _FinalStage server(Server server); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional server = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional async = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FunctionTool other) { + async(other.getAsync()); + messages(other.getMessages()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + /** + *

This is the unique identifier for the tool.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the organization that this tool belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the tool was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the tool was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the server that will be hit when this tool is requested by the model.

+ *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + @java.lang.Override + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public _FinalStage server(Optional server) { + this.server = server; + return this; + } + + /** + *

This is the function definition of the tool.

+ *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @java.lang.Override + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public _FinalStage function(Optional function) { + this.function = function; + return this; + } + + /** + *

These are the messages that will be spoken to the user as the tool is running.

+ *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + /** + *

This determines if the tool is async.

+ *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @java.lang.Override + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public _FinalStage async(Optional async) { + this.async = async; + return this; + } + + @java.lang.Override + public FunctionTool build() { + return new FunctionTool( + async, messages, id, orgId, createdAt, updatedAt, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/FunctionToolMessagesItem.java b/src/main/java/com/vapi/api/types/FunctionToolMessagesItem.java new file mode 100644 index 0000000..ffafab2 --- /dev/null +++ b/src/main/java/com/vapi/api/types/FunctionToolMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class FunctionToolMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private FunctionToolMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static FunctionToolMessagesItem requestStart(ToolMessageStart value) { + return new FunctionToolMessagesItem(new RequestStartValue(value)); + } + + public static FunctionToolMessagesItem requestComplete(ToolMessageComplete value) { + return new FunctionToolMessagesItem(new RequestCompleteValue(value)); + } + + public static FunctionToolMessagesItem requestFailed(ToolMessageFailed value) { + return new FunctionToolMessagesItem(new RequestFailedValue(value)); + } + + public static FunctionToolMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new FunctionToolMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "FunctionToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "FunctionToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "FunctionToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "FunctionToolMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "FunctionToolMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/FunctionToolProviderDetails.java b/src/main/java/com/vapi/api/types/FunctionToolProviderDetails.java new file mode 100644 index 0000000..a5062c4 --- /dev/null +++ b/src/main/java/com/vapi/api/types/FunctionToolProviderDetails.java @@ -0,0 +1,124 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FunctionToolProviderDetails.Builder.class) +public final class FunctionToolProviderDetails { + private final Optional templateUrl; + + private final Optional> setupInstructions; + + private final Map additionalProperties; + + private FunctionToolProviderDetails( + Optional templateUrl, + Optional> setupInstructions, + Map additionalProperties) { + this.templateUrl = templateUrl; + this.setupInstructions = setupInstructions; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the Template URL or the Snapshot URL corresponding to the Template. + */ + @JsonProperty("templateUrl") + public Optional getTemplateUrl() { + return templateUrl; + } + + @JsonProperty("setupInstructions") + public Optional> getSetupInstructions() { + return setupInstructions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionToolProviderDetails && equalTo((FunctionToolProviderDetails) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FunctionToolProviderDetails other) { + return templateUrl.equals(other.templateUrl) && setupInstructions.equals(other.setupInstructions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.templateUrl, this.setupInstructions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional templateUrl = Optional.empty(); + + private Optional> setupInstructions = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(FunctionToolProviderDetails other) { + templateUrl(other.getTemplateUrl()); + setupInstructions(other.getSetupInstructions()); + return this; + } + + @JsonSetter(value = "templateUrl", nulls = Nulls.SKIP) + public Builder templateUrl(Optional templateUrl) { + this.templateUrl = templateUrl; + return this; + } + + public Builder templateUrl(String templateUrl) { + this.templateUrl = Optional.ofNullable(templateUrl); + return this; + } + + @JsonSetter(value = "setupInstructions", nulls = Nulls.SKIP) + public Builder setupInstructions(Optional> setupInstructions) { + this.setupInstructions = setupInstructions; + return this; + } + + public Builder setupInstructions(List setupInstructions) { + this.setupInstructions = Optional.ofNullable(setupInstructions); + return this; + } + + public FunctionToolProviderDetails build() { + return new FunctionToolProviderDetails(templateUrl, setupInstructions, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/FunctionToolWithToolCall.java b/src/main/java/com/vapi/api/types/FunctionToolWithToolCall.java new file mode 100644 index 0000000..7f4c566 --- /dev/null +++ b/src/main/java/com/vapi/api/types/FunctionToolWithToolCall.java @@ -0,0 +1,271 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = FunctionToolWithToolCall.Builder.class) +public final class FunctionToolWithToolCall { + private final Optional async; + + private final Optional> messages; + + private final ToolCall toolCall; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private FunctionToolWithToolCall( + Optional async, + Optional> messages, + ToolCall toolCall, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.toolCall = toolCall; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + @JsonProperty("toolCall") + public ToolCall getToolCall() { + return toolCall; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionToolWithToolCall && equalTo((FunctionToolWithToolCall) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(FunctionToolWithToolCall other) { + return async.equals(other.async) + && messages.equals(other.messages) + && toolCall.equals(other.toolCall) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.async, this.messages, this.toolCall, this.function, this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ToolCallStage builder() { + return new Builder(); + } + + public interface ToolCallStage { + _FinalStage toolCall(@NotNull ToolCall toolCall); + + Builder from(FunctionToolWithToolCall other); + } + + public interface _FinalStage { + FunctionToolWithToolCall build(); + + _FinalStage async(Optional async); + + _FinalStage async(Boolean async); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage function(Optional function); + + _FinalStage function(OpenAiFunction function); + + _FinalStage server(Optional server); + + _FinalStage server(Server server); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ToolCallStage, _FinalStage { + private ToolCall toolCall; + + private Optional server = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional async = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(FunctionToolWithToolCall other) { + async(other.getAsync()); + messages(other.getMessages()); + toolCall(other.getToolCall()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + @java.lang.Override + @JsonSetter("toolCall") + public _FinalStage toolCall(@NotNull ToolCall toolCall) { + this.toolCall = Objects.requireNonNull(toolCall, "toolCall must not be null"); + return this; + } + + /** + *

This is the server that will be hit when this tool is requested by the model.

+ *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + @java.lang.Override + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public _FinalStage server(Optional server) { + this.server = server; + return this; + } + + /** + *

This is the function definition of the tool.

+ *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @java.lang.Override + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public _FinalStage function(Optional function) { + this.function = function; + return this; + } + + /** + *

These are the messages that will be spoken to the user as the tool is running.

+ *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + /** + *

This determines if the tool is async.

+ *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @java.lang.Override + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public _FinalStage async(Optional async) { + this.async = async; + return this; + } + + @java.lang.Override + public FunctionToolWithToolCall build() { + return new FunctionToolWithToolCall(async, messages, toolCall, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/FunctionToolWithToolCallMessagesItem.java b/src/main/java/com/vapi/api/types/FunctionToolWithToolCallMessagesItem.java new file mode 100644 index 0000000..672eb4c --- /dev/null +++ b/src/main/java/com/vapi/api/types/FunctionToolWithToolCallMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class FunctionToolWithToolCallMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private FunctionToolWithToolCallMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static FunctionToolWithToolCallMessagesItem requestStart(ToolMessageStart value) { + return new FunctionToolWithToolCallMessagesItem(new RequestStartValue(value)); + } + + public static FunctionToolWithToolCallMessagesItem requestComplete(ToolMessageComplete value) { + return new FunctionToolWithToolCallMessagesItem(new RequestCompleteValue(value)); + } + + public static FunctionToolWithToolCallMessagesItem requestFailed(ToolMessageFailed value) { + return new FunctionToolWithToolCallMessagesItem(new RequestFailedValue(value)); + } + + public static FunctionToolWithToolCallMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new FunctionToolWithToolCallMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "FunctionToolWithToolCallMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "FunctionToolWithToolCallMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "FunctionToolWithToolCallMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "FunctionToolWithToolCallMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "FunctionToolWithToolCallMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/GcpCredential.java b/src/main/java/com/vapi/api/types/GcpCredential.java new file mode 100644 index 0000000..e474056 --- /dev/null +++ b/src/main/java/com/vapi/api/types/GcpCredential.java @@ -0,0 +1,321 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GcpCredential.Builder.class) +public final class GcpCredential { + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional name; + + private final GcpKey gcpKey; + + private final Optional bucketPlan; + + private final Map additionalProperties; + + private GcpCredential( + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional name, + GcpKey gcpKey, + Optional bucketPlan, + Map additionalProperties) { + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.name = name; + this.gcpKey = gcpKey; + this.bucketPlan = bucketPlan; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "gcp"; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the name of the GCP credential. This is just for your reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the GCP key. This is the JSON that can be generated in the Google Cloud Console at https://console.cloud.google.com/iam-admin/serviceaccounts/details/<service-account-id>/keys. + *

The schema is identical to the JSON that GCP outputs.

+ */ + @JsonProperty("gcpKey") + public GcpKey getGcpKey() { + return gcpKey; + } + + /** + * @return This is the bucket plan that can be provided to store call artifacts in GCP. + */ + @JsonProperty("bucketPlan") + public Optional getBucketPlan() { + return bucketPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GcpCredential && equalTo((GcpCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GcpCredential other) { + return id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && name.equals(other.name) + && gcpKey.equals(other.gcpKey) + && bucketPlan.equals(other.bucketPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, this.orgId, this.createdAt, this.updatedAt, this.name, this.gcpKey, this.bucketPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(GcpCredential other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + GcpKeyStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface GcpKeyStage { + _FinalStage gcpKey(@NotNull GcpKey gcpKey); + } + + public interface _FinalStage { + GcpCredential build(); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage bucketPlan(Optional bucketPlan); + + _FinalStage bucketPlan(BucketPlan bucketPlan); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, GcpKeyStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private GcpKey gcpKey; + + private Optional bucketPlan = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GcpCredential other) { + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + name(other.getName()); + gcpKey(other.getGcpKey()); + bucketPlan(other.getBucketPlan()); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public GcpKeyStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the GCP key. This is the JSON that can be generated in the Google Cloud Console at https://console.cloud.google.com/iam-admin/serviceaccounts/details/<service-account-id>/keys.

+ *

The schema is identical to the JSON that GCP outputs.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("gcpKey") + public _FinalStage gcpKey(@NotNull GcpKey gcpKey) { + this.gcpKey = Objects.requireNonNull(gcpKey, "gcpKey must not be null"); + return this; + } + + /** + *

This is the bucket plan that can be provided to store call artifacts in GCP.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bucketPlan(BucketPlan bucketPlan) { + this.bucketPlan = Optional.ofNullable(bucketPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "bucketPlan", nulls = Nulls.SKIP) + public _FinalStage bucketPlan(Optional bucketPlan) { + this.bucketPlan = bucketPlan; + return this; + } + + /** + *

This is the name of the GCP credential. This is just for your reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public GcpCredential build() { + return new GcpCredential(id, orgId, createdAt, updatedAt, name, gcpKey, bucketPlan, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/GcpKey.java b/src/main/java/com/vapi/api/types/GcpKey.java new file mode 100644 index 0000000..e389235 --- /dev/null +++ b/src/main/java/com/vapi/api/types/GcpKey.java @@ -0,0 +1,459 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GcpKey.Builder.class) +public final class GcpKey { + private final String type; + + private final String projectId; + + private final String privateKeyId; + + private final String privateKey; + + private final String clientEmail; + + private final String clientId; + + private final String authUri; + + private final String tokenUri; + + private final String authProviderX509CertUrl; + + private final String clientX509CertUrl; + + private final String universeDomain; + + private final Map additionalProperties; + + private GcpKey( + String type, + String projectId, + String privateKeyId, + String privateKey, + String clientEmail, + String clientId, + String authUri, + String tokenUri, + String authProviderX509CertUrl, + String clientX509CertUrl, + String universeDomain, + Map additionalProperties) { + this.type = type; + this.projectId = projectId; + this.privateKeyId = privateKeyId; + this.privateKey = privateKey; + this.clientEmail = clientEmail; + this.clientId = clientId; + this.authUri = authUri; + this.tokenUri = tokenUri; + this.authProviderX509CertUrl = authProviderX509CertUrl; + this.clientX509CertUrl = clientX509CertUrl; + this.universeDomain = universeDomain; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the type of the key. Most likely, this is "service_account". + */ + @JsonProperty("type") + public String getType() { + return type; + } + + /** + * @return This is the ID of the Google Cloud project associated with this key. + */ + @JsonProperty("projectId") + public String getProjectId() { + return projectId; + } + + /** + * @return This is the unique identifier for the private key. + */ + @JsonProperty("privateKeyId") + public String getPrivateKeyId() { + return privateKeyId; + } + + /** + * @return This is the private key in PEM format. + *

Note: This is not returned in the API.

+ */ + @JsonProperty("privateKey") + public String getPrivateKey() { + return privateKey; + } + + /** + * @return This is the email address associated with the service account. + */ + @JsonProperty("clientEmail") + public String getClientEmail() { + return clientEmail; + } + + /** + * @return This is the unique identifier for the client. + */ + @JsonProperty("clientId") + public String getClientId() { + return clientId; + } + + /** + * @return This is the URI for the auth provider's authorization endpoint. + */ + @JsonProperty("authUri") + public String getAuthUri() { + return authUri; + } + + /** + * @return This is the URI for the auth provider's token endpoint. + */ + @JsonProperty("tokenUri") + public String getTokenUri() { + return tokenUri; + } + + /** + * @return This is the URL of the public x509 certificate for the auth provider. + */ + @JsonProperty("authProviderX509CertUrl") + public String getAuthProviderX509CertUrl() { + return authProviderX509CertUrl; + } + + /** + * @return This is the URL of the public x509 certificate for the client. + */ + @JsonProperty("clientX509CertUrl") + public String getClientX509CertUrl() { + return clientX509CertUrl; + } + + /** + * @return This is the domain associated with the universe this service account belongs to. + */ + @JsonProperty("universeDomain") + public String getUniverseDomain() { + return universeDomain; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GcpKey && equalTo((GcpKey) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GcpKey other) { + return type.equals(other.type) + && projectId.equals(other.projectId) + && privateKeyId.equals(other.privateKeyId) + && privateKey.equals(other.privateKey) + && clientEmail.equals(other.clientEmail) + && clientId.equals(other.clientId) + && authUri.equals(other.authUri) + && tokenUri.equals(other.tokenUri) + && authProviderX509CertUrl.equals(other.authProviderX509CertUrl) + && clientX509CertUrl.equals(other.clientX509CertUrl) + && universeDomain.equals(other.universeDomain); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.projectId, + this.privateKeyId, + this.privateKey, + this.clientEmail, + this.clientId, + this.authUri, + this.tokenUri, + this.authProviderX509CertUrl, + this.clientX509CertUrl, + this.universeDomain); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + ProjectIdStage type(@NotNull String type); + + Builder from(GcpKey other); + } + + public interface ProjectIdStage { + PrivateKeyIdStage projectId(@NotNull String projectId); + } + + public interface PrivateKeyIdStage { + PrivateKeyStage privateKeyId(@NotNull String privateKeyId); + } + + public interface PrivateKeyStage { + ClientEmailStage privateKey(@NotNull String privateKey); + } + + public interface ClientEmailStage { + ClientIdStage clientEmail(@NotNull String clientEmail); + } + + public interface ClientIdStage { + AuthUriStage clientId(@NotNull String clientId); + } + + public interface AuthUriStage { + TokenUriStage authUri(@NotNull String authUri); + } + + public interface TokenUriStage { + AuthProviderX509CertUrlStage tokenUri(@NotNull String tokenUri); + } + + public interface AuthProviderX509CertUrlStage { + ClientX509CertUrlStage authProviderX509CertUrl(@NotNull String authProviderX509CertUrl); + } + + public interface ClientX509CertUrlStage { + UniverseDomainStage clientX509CertUrl(@NotNull String clientX509CertUrl); + } + + public interface UniverseDomainStage { + _FinalStage universeDomain(@NotNull String universeDomain); + } + + public interface _FinalStage { + GcpKey build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements TypeStage, + ProjectIdStage, + PrivateKeyIdStage, + PrivateKeyStage, + ClientEmailStage, + ClientIdStage, + AuthUriStage, + TokenUriStage, + AuthProviderX509CertUrlStage, + ClientX509CertUrlStage, + UniverseDomainStage, + _FinalStage { + private String type; + + private String projectId; + + private String privateKeyId; + + private String privateKey; + + private String clientEmail; + + private String clientId; + + private String authUri; + + private String tokenUri; + + private String authProviderX509CertUrl; + + private String clientX509CertUrl; + + private String universeDomain; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GcpKey other) { + type(other.getType()); + projectId(other.getProjectId()); + privateKeyId(other.getPrivateKeyId()); + privateKey(other.getPrivateKey()); + clientEmail(other.getClientEmail()); + clientId(other.getClientId()); + authUri(other.getAuthUri()); + tokenUri(other.getTokenUri()); + authProviderX509CertUrl(other.getAuthProviderX509CertUrl()); + clientX509CertUrl(other.getClientX509CertUrl()); + universeDomain(other.getUniverseDomain()); + return this; + } + + /** + *

This is the type of the key. Most likely, this is "service_account".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public ProjectIdStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

This is the ID of the Google Cloud project associated with this key.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("projectId") + public PrivateKeyIdStage projectId(@NotNull String projectId) { + this.projectId = Objects.requireNonNull(projectId, "projectId must not be null"); + return this; + } + + /** + *

This is the unique identifier for the private key.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("privateKeyId") + public PrivateKeyStage privateKeyId(@NotNull String privateKeyId) { + this.privateKeyId = Objects.requireNonNull(privateKeyId, "privateKeyId must not be null"); + return this; + } + + /** + *

This is the private key in PEM format.

+ *

Note: This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("privateKey") + public ClientEmailStage privateKey(@NotNull String privateKey) { + this.privateKey = Objects.requireNonNull(privateKey, "privateKey must not be null"); + return this; + } + + /** + *

This is the email address associated with the service account.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("clientEmail") + public ClientIdStage clientEmail(@NotNull String clientEmail) { + this.clientEmail = Objects.requireNonNull(clientEmail, "clientEmail must not be null"); + return this; + } + + /** + *

This is the unique identifier for the client.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("clientId") + public AuthUriStage clientId(@NotNull String clientId) { + this.clientId = Objects.requireNonNull(clientId, "clientId must not be null"); + return this; + } + + /** + *

This is the URI for the auth provider's authorization endpoint.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("authUri") + public TokenUriStage authUri(@NotNull String authUri) { + this.authUri = Objects.requireNonNull(authUri, "authUri must not be null"); + return this; + } + + /** + *

This is the URI for the auth provider's token endpoint.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("tokenUri") + public AuthProviderX509CertUrlStage tokenUri(@NotNull String tokenUri) { + this.tokenUri = Objects.requireNonNull(tokenUri, "tokenUri must not be null"); + return this; + } + + /** + *

This is the URL of the public x509 certificate for the auth provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("authProviderX509CertUrl") + public ClientX509CertUrlStage authProviderX509CertUrl(@NotNull String authProviderX509CertUrl) { + this.authProviderX509CertUrl = + Objects.requireNonNull(authProviderX509CertUrl, "authProviderX509CertUrl must not be null"); + return this; + } + + /** + *

This is the URL of the public x509 certificate for the client.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("clientX509CertUrl") + public UniverseDomainStage clientX509CertUrl(@NotNull String clientX509CertUrl) { + this.clientX509CertUrl = Objects.requireNonNull(clientX509CertUrl, "clientX509CertUrl must not be null"); + return this; + } + + /** + *

This is the domain associated with the universe this service account belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("universeDomain") + public _FinalStage universeDomain(@NotNull String universeDomain) { + this.universeDomain = Objects.requireNonNull(universeDomain, "universeDomain must not be null"); + return this; + } + + @java.lang.Override + public GcpKey build() { + return new GcpKey( + type, + projectId, + privateKeyId, + privateKey, + clientEmail, + clientId, + authUri, + tokenUri, + authProviderX509CertUrl, + clientX509CertUrl, + universeDomain, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/GhlTool.java b/src/main/java/com/vapi/api/types/GhlTool.java new file mode 100644 index 0000000..224f7f8 --- /dev/null +++ b/src/main/java/com/vapi/api/types/GhlTool.java @@ -0,0 +1,407 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GhlTool.Builder.class) +public final class GhlTool { + private final Optional async; + + private final Optional> messages; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional function; + + private final Optional server; + + private final GhlToolMetadata metadata; + + private final Map additionalProperties; + + private GhlTool( + Optional async, + Optional> messages, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional function, + Optional server, + GhlToolMetadata metadata, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.function = function; + this.server = server; + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the unique identifier for the tool. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the organization that this tool belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the tool was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the tool was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @JsonProperty("metadata") + public GhlToolMetadata getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlTool && equalTo((GhlTool) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GhlTool other) { + return async.equals(other.async) + && messages.equals(other.messages) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && function.equals(other.function) + && server.equals(other.server) + && metadata.equals(other.metadata); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.async, + this.messages, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.function, + this.server, + this.metadata); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(GhlTool other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface MetadataStage { + _FinalStage metadata(@NotNull GhlToolMetadata metadata); + } + + public interface _FinalStage { + GhlTool build(); + + _FinalStage async(Optional async); + + _FinalStage async(Boolean async); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage function(Optional function); + + _FinalStage function(OpenAiFunction function); + + _FinalStage server(Optional server); + + _FinalStage server(Server server); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, MetadataStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private GhlToolMetadata metadata; + + private Optional server = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional async = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GhlTool other) { + async(other.getAsync()); + messages(other.getMessages()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + function(other.getFunction()); + server(other.getServer()); + metadata(other.getMetadata()); + return this; + } + + /** + *

This is the unique identifier for the tool.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the organization that this tool belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the tool was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the tool was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("metadata") + public _FinalStage metadata(@NotNull GhlToolMetadata metadata) { + this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); + return this; + } + + /** + *

This is the server that will be hit when this tool is requested by the model.

+ *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + @java.lang.Override + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public _FinalStage server(Optional server) { + this.server = server; + return this; + } + + /** + *

This is the function definition of the tool.

+ *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @java.lang.Override + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public _FinalStage function(Optional function) { + this.function = function; + return this; + } + + /** + *

These are the messages that will be spoken to the user as the tool is running.

+ *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + /** + *

This determines if the tool is async.

+ *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @java.lang.Override + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public _FinalStage async(Optional async) { + this.async = async; + return this; + } + + @java.lang.Override + public GhlTool build() { + return new GhlTool( + async, messages, id, orgId, createdAt, updatedAt, function, server, metadata, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/GhlToolMessagesItem.java b/src/main/java/com/vapi/api/types/GhlToolMessagesItem.java new file mode 100644 index 0000000..b4d7486 --- /dev/null +++ b/src/main/java/com/vapi/api/types/GhlToolMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class GhlToolMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private GhlToolMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static GhlToolMessagesItem requestStart(ToolMessageStart value) { + return new GhlToolMessagesItem(new RequestStartValue(value)); + } + + public static GhlToolMessagesItem requestComplete(ToolMessageComplete value) { + return new GhlToolMessagesItem(new RequestCompleteValue(value)); + } + + public static GhlToolMessagesItem requestFailed(ToolMessageFailed value) { + return new GhlToolMessagesItem(new RequestFailedValue(value)); + } + + public static GhlToolMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new GhlToolMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "GhlToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "GhlToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "GhlToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "GhlToolMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "GhlToolMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/GhlToolMetadata.java b/src/main/java/com/vapi/api/types/GhlToolMetadata.java new file mode 100644 index 0000000..f0876d6 --- /dev/null +++ b/src/main/java/com/vapi/api/types/GhlToolMetadata.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GhlToolMetadata.Builder.class) +public final class GhlToolMetadata { + private final Optional workflowId; + + private final Optional locationId; + + private final Map additionalProperties; + + private GhlToolMetadata( + Optional workflowId, Optional locationId, Map additionalProperties) { + this.workflowId = workflowId; + this.locationId = locationId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("workflowId") + public Optional getWorkflowId() { + return workflowId; + } + + @JsonProperty("locationId") + public Optional getLocationId() { + return locationId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlToolMetadata && equalTo((GhlToolMetadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GhlToolMetadata other) { + return workflowId.equals(other.workflowId) && locationId.equals(other.locationId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.workflowId, this.locationId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional workflowId = Optional.empty(); + + private Optional locationId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GhlToolMetadata other) { + workflowId(other.getWorkflowId()); + locationId(other.getLocationId()); + return this; + } + + @JsonSetter(value = "workflowId", nulls = Nulls.SKIP) + public Builder workflowId(Optional workflowId) { + this.workflowId = workflowId; + return this; + } + + public Builder workflowId(String workflowId) { + this.workflowId = Optional.ofNullable(workflowId); + return this; + } + + @JsonSetter(value = "locationId", nulls = Nulls.SKIP) + public Builder locationId(Optional locationId) { + this.locationId = locationId; + return this; + } + + public Builder locationId(String locationId) { + this.locationId = Optional.ofNullable(locationId); + return this; + } + + public GhlToolMetadata build() { + return new GhlToolMetadata(workflowId, locationId, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/GhlToolProviderDetails.java b/src/main/java/com/vapi/api/types/GhlToolProviderDetails.java new file mode 100644 index 0000000..e81c2ea --- /dev/null +++ b/src/main/java/com/vapi/api/types/GhlToolProviderDetails.java @@ -0,0 +1,260 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GhlToolProviderDetails.Builder.class) +public final class GhlToolProviderDetails { + private final Optional templateUrl; + + private final Optional> setupInstructions; + + private final Optional workflowId; + + private final Optional workflowName; + + private final Optional webhookHookId; + + private final Optional webhookHookName; + + private final Optional locationId; + + private final Map additionalProperties; + + private GhlToolProviderDetails( + Optional templateUrl, + Optional> setupInstructions, + Optional workflowId, + Optional workflowName, + Optional webhookHookId, + Optional webhookHookName, + Optional locationId, + Map additionalProperties) { + this.templateUrl = templateUrl; + this.setupInstructions = setupInstructions; + this.workflowId = workflowId; + this.workflowName = workflowName; + this.webhookHookId = webhookHookId; + this.webhookHookName = webhookHookName; + this.locationId = locationId; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the Template URL or the Snapshot URL corresponding to the Template. + */ + @JsonProperty("templateUrl") + public Optional getTemplateUrl() { + return templateUrl; + } + + @JsonProperty("setupInstructions") + public Optional> getSetupInstructions() { + return setupInstructions; + } + + @JsonProperty("workflowId") + public Optional getWorkflowId() { + return workflowId; + } + + @JsonProperty("workflowName") + public Optional getWorkflowName() { + return workflowName; + } + + @JsonProperty("webhookHookId") + public Optional getWebhookHookId() { + return webhookHookId; + } + + @JsonProperty("webhookHookName") + public Optional getWebhookHookName() { + return webhookHookName; + } + + @JsonProperty("locationId") + public Optional getLocationId() { + return locationId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlToolProviderDetails && equalTo((GhlToolProviderDetails) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GhlToolProviderDetails other) { + return templateUrl.equals(other.templateUrl) + && setupInstructions.equals(other.setupInstructions) + && workflowId.equals(other.workflowId) + && workflowName.equals(other.workflowName) + && webhookHookId.equals(other.webhookHookId) + && webhookHookName.equals(other.webhookHookName) + && locationId.equals(other.locationId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.templateUrl, + this.setupInstructions, + this.workflowId, + this.workflowName, + this.webhookHookId, + this.webhookHookName, + this.locationId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional templateUrl = Optional.empty(); + + private Optional> setupInstructions = Optional.empty(); + + private Optional workflowId = Optional.empty(); + + private Optional workflowName = Optional.empty(); + + private Optional webhookHookId = Optional.empty(); + + private Optional webhookHookName = Optional.empty(); + + private Optional locationId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GhlToolProviderDetails other) { + templateUrl(other.getTemplateUrl()); + setupInstructions(other.getSetupInstructions()); + workflowId(other.getWorkflowId()); + workflowName(other.getWorkflowName()); + webhookHookId(other.getWebhookHookId()); + webhookHookName(other.getWebhookHookName()); + locationId(other.getLocationId()); + return this; + } + + @JsonSetter(value = "templateUrl", nulls = Nulls.SKIP) + public Builder templateUrl(Optional templateUrl) { + this.templateUrl = templateUrl; + return this; + } + + public Builder templateUrl(String templateUrl) { + this.templateUrl = Optional.ofNullable(templateUrl); + return this; + } + + @JsonSetter(value = "setupInstructions", nulls = Nulls.SKIP) + public Builder setupInstructions(Optional> setupInstructions) { + this.setupInstructions = setupInstructions; + return this; + } + + public Builder setupInstructions(List setupInstructions) { + this.setupInstructions = Optional.ofNullable(setupInstructions); + return this; + } + + @JsonSetter(value = "workflowId", nulls = Nulls.SKIP) + public Builder workflowId(Optional workflowId) { + this.workflowId = workflowId; + return this; + } + + public Builder workflowId(String workflowId) { + this.workflowId = Optional.ofNullable(workflowId); + return this; + } + + @JsonSetter(value = "workflowName", nulls = Nulls.SKIP) + public Builder workflowName(Optional workflowName) { + this.workflowName = workflowName; + return this; + } + + public Builder workflowName(String workflowName) { + this.workflowName = Optional.ofNullable(workflowName); + return this; + } + + @JsonSetter(value = "webhookHookId", nulls = Nulls.SKIP) + public Builder webhookHookId(Optional webhookHookId) { + this.webhookHookId = webhookHookId; + return this; + } + + public Builder webhookHookId(String webhookHookId) { + this.webhookHookId = Optional.ofNullable(webhookHookId); + return this; + } + + @JsonSetter(value = "webhookHookName", nulls = Nulls.SKIP) + public Builder webhookHookName(Optional webhookHookName) { + this.webhookHookName = webhookHookName; + return this; + } + + public Builder webhookHookName(String webhookHookName) { + this.webhookHookName = Optional.ofNullable(webhookHookName); + return this; + } + + @JsonSetter(value = "locationId", nulls = Nulls.SKIP) + public Builder locationId(Optional locationId) { + this.locationId = locationId; + return this; + } + + public Builder locationId(String locationId) { + this.locationId = Optional.ofNullable(locationId); + return this; + } + + public GhlToolProviderDetails build() { + return new GhlToolProviderDetails( + templateUrl, + setupInstructions, + workflowId, + workflowName, + webhookHookId, + webhookHookName, + locationId, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/GhlToolWithToolCall.java b/src/main/java/com/vapi/api/types/GhlToolWithToolCall.java new file mode 100644 index 0000000..2509099 --- /dev/null +++ b/src/main/java/com/vapi/api/types/GhlToolWithToolCall.java @@ -0,0 +1,295 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GhlToolWithToolCall.Builder.class) +public final class GhlToolWithToolCall { + private final Optional async; + + private final Optional> messages; + + private final ToolCall toolCall; + + private final GhlToolMetadata metadata; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private GhlToolWithToolCall( + Optional async, + Optional> messages, + ToolCall toolCall, + GhlToolMetadata metadata, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.toolCall = toolCall; + this.metadata = metadata; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + @JsonProperty("toolCall") + public ToolCall getToolCall() { + return toolCall; + } + + @JsonProperty("metadata") + public GhlToolMetadata getMetadata() { + return metadata; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlToolWithToolCall && equalTo((GhlToolWithToolCall) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GhlToolWithToolCall other) { + return async.equals(other.async) + && messages.equals(other.messages) + && toolCall.equals(other.toolCall) + && metadata.equals(other.metadata) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.async, this.messages, this.toolCall, this.metadata, this.function, this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ToolCallStage builder() { + return new Builder(); + } + + public interface ToolCallStage { + MetadataStage toolCall(@NotNull ToolCall toolCall); + + Builder from(GhlToolWithToolCall other); + } + + public interface MetadataStage { + _FinalStage metadata(@NotNull GhlToolMetadata metadata); + } + + public interface _FinalStage { + GhlToolWithToolCall build(); + + _FinalStage async(Optional async); + + _FinalStage async(Boolean async); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage function(Optional function); + + _FinalStage function(OpenAiFunction function); + + _FinalStage server(Optional server); + + _FinalStage server(Server server); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ToolCallStage, MetadataStage, _FinalStage { + private ToolCall toolCall; + + private GhlToolMetadata metadata; + + private Optional server = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional async = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GhlToolWithToolCall other) { + async(other.getAsync()); + messages(other.getMessages()); + toolCall(other.getToolCall()); + metadata(other.getMetadata()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + @java.lang.Override + @JsonSetter("toolCall") + public MetadataStage toolCall(@NotNull ToolCall toolCall) { + this.toolCall = Objects.requireNonNull(toolCall, "toolCall must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("metadata") + public _FinalStage metadata(@NotNull GhlToolMetadata metadata) { + this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); + return this; + } + + /** + *

This is the server that will be hit when this tool is requested by the model.

+ *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + @java.lang.Override + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public _FinalStage server(Optional server) { + this.server = server; + return this; + } + + /** + *

This is the function definition of the tool.

+ *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @java.lang.Override + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public _FinalStage function(Optional function) { + this.function = function; + return this; + } + + /** + *

These are the messages that will be spoken to the user as the tool is running.

+ *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + /** + *

This determines if the tool is async.

+ *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @java.lang.Override + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public _FinalStage async(Optional async) { + this.async = async; + return this; + } + + @java.lang.Override + public GhlToolWithToolCall build() { + return new GhlToolWithToolCall(async, messages, toolCall, metadata, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/GhlToolWithToolCallMessagesItem.java b/src/main/java/com/vapi/api/types/GhlToolWithToolCallMessagesItem.java new file mode 100644 index 0000000..9e26f3d --- /dev/null +++ b/src/main/java/com/vapi/api/types/GhlToolWithToolCallMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class GhlToolWithToolCallMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private GhlToolWithToolCallMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static GhlToolWithToolCallMessagesItem requestStart(ToolMessageStart value) { + return new GhlToolWithToolCallMessagesItem(new RequestStartValue(value)); + } + + public static GhlToolWithToolCallMessagesItem requestComplete(ToolMessageComplete value) { + return new GhlToolWithToolCallMessagesItem(new RequestCompleteValue(value)); + } + + public static GhlToolWithToolCallMessagesItem requestFailed(ToolMessageFailed value) { + return new GhlToolWithToolCallMessagesItem(new RequestFailedValue(value)); + } + + public static GhlToolWithToolCallMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new GhlToolWithToolCallMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "GhlToolWithToolCallMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "GhlToolWithToolCallMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "GhlToolWithToolCallMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "GhlToolWithToolCallMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "GhlToolWithToolCallMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/GladiaCredential.java b/src/main/java/com/vapi/api/types/GladiaCredential.java new file mode 100644 index 0000000..97d9744 --- /dev/null +++ b/src/main/java/com/vapi/api/types/GladiaCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GladiaCredential.Builder.class) +public final class GladiaCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private GladiaCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "gladia"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GladiaCredential && equalTo((GladiaCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GladiaCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(GladiaCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + GladiaCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GladiaCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public GladiaCredential build() { + return new GladiaCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/GladiaTranscriber.java b/src/main/java/com/vapi/api/types/GladiaTranscriber.java new file mode 100644 index 0000000..7e43662 --- /dev/null +++ b/src/main/java/com/vapi/api/types/GladiaTranscriber.java @@ -0,0 +1,243 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GladiaTranscriber.Builder.class) +public final class GladiaTranscriber { + private final Optional model; + + private final Optional languageBehaviour; + + private final Optional language; + + private final Optional transcriptionHint; + + private final Optional prosody; + + private final Optional audioEnhancer; + + private final Map additionalProperties; + + private GladiaTranscriber( + Optional model, + Optional languageBehaviour, + Optional language, + Optional transcriptionHint, + Optional prosody, + Optional audioEnhancer, + Map additionalProperties) { + this.model = model; + this.languageBehaviour = languageBehaviour; + this.language = language; + this.transcriptionHint = transcriptionHint; + this.prosody = prosody; + this.audioEnhancer = audioEnhancer; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("model") + public Optional getModel() { + return model; + } + + @JsonProperty("languageBehaviour") + public Optional getLanguageBehaviour() { + return languageBehaviour; + } + + /** + * @return Defines the language to use for the transcription. Required when languageBehaviour is 'manual'. + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + /** + * @return Provides a custom vocabulary to the model to improve accuracy of transcribing context specific words, technical terms, names, etc. If empty, this argument is ignored. + * ⚠️ Warning ⚠️: Please be aware that the transcription_hint field has a character limit of 600. If you provide a transcription_hint longer than 600 characters, it will be automatically truncated to meet this limit. + */ + @JsonProperty("transcriptionHint") + public Optional getTranscriptionHint() { + return transcriptionHint; + } + + /** + * @return If prosody is true, you will get a transcription that can contain prosodies i.e. (laugh) (giggles) (malefic laugh) (toss) (music)… Default value is false. + */ + @JsonProperty("prosody") + public Optional getProsody() { + return prosody; + } + + /** + * @return If true, audio will be pre-processed to improve accuracy but latency will increase. Default value is false. + */ + @JsonProperty("audioEnhancer") + public Optional getAudioEnhancer() { + return audioEnhancer; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GladiaTranscriber && equalTo((GladiaTranscriber) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GladiaTranscriber other) { + return model.equals(other.model) + && languageBehaviour.equals(other.languageBehaviour) + && language.equals(other.language) + && transcriptionHint.equals(other.transcriptionHint) + && prosody.equals(other.prosody) + && audioEnhancer.equals(other.audioEnhancer); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.model, + this.languageBehaviour, + this.language, + this.transcriptionHint, + this.prosody, + this.audioEnhancer); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional model = Optional.empty(); + + private Optional languageBehaviour = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional transcriptionHint = Optional.empty(); + + private Optional prosody = Optional.empty(); + + private Optional audioEnhancer = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GladiaTranscriber other) { + model(other.getModel()); + languageBehaviour(other.getLanguageBehaviour()); + language(other.getLanguage()); + transcriptionHint(other.getTranscriptionHint()); + prosody(other.getProsody()); + audioEnhancer(other.getAudioEnhancer()); + return this; + } + + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public Builder model(Optional model) { + this.model = model; + return this; + } + + public Builder model(GladiaTranscriberModel model) { + this.model = Optional.ofNullable(model); + return this; + } + + @JsonSetter(value = "languageBehaviour", nulls = Nulls.SKIP) + public Builder languageBehaviour(Optional languageBehaviour) { + this.languageBehaviour = languageBehaviour; + return this; + } + + public Builder languageBehaviour(GladiaTranscriberLanguageBehaviour languageBehaviour) { + this.languageBehaviour = Optional.ofNullable(languageBehaviour); + return this; + } + + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public Builder language(Optional language) { + this.language = language; + return this; + } + + public Builder language(GladiaTranscriberLanguage language) { + this.language = Optional.ofNullable(language); + return this; + } + + @JsonSetter(value = "transcriptionHint", nulls = Nulls.SKIP) + public Builder transcriptionHint(Optional transcriptionHint) { + this.transcriptionHint = transcriptionHint; + return this; + } + + public Builder transcriptionHint(String transcriptionHint) { + this.transcriptionHint = Optional.ofNullable(transcriptionHint); + return this; + } + + @JsonSetter(value = "prosody", nulls = Nulls.SKIP) + public Builder prosody(Optional prosody) { + this.prosody = prosody; + return this; + } + + public Builder prosody(Boolean prosody) { + this.prosody = Optional.ofNullable(prosody); + return this; + } + + @JsonSetter(value = "audioEnhancer", nulls = Nulls.SKIP) + public Builder audioEnhancer(Optional audioEnhancer) { + this.audioEnhancer = audioEnhancer; + return this; + } + + public Builder audioEnhancer(Boolean audioEnhancer) { + this.audioEnhancer = Optional.ofNullable(audioEnhancer); + return this; + } + + public GladiaTranscriber build() { + return new GladiaTranscriber( + model, + languageBehaviour, + language, + transcriptionHint, + prosody, + audioEnhancer, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/GladiaTranscriberLanguage.java b/src/main/java/com/vapi/api/types/GladiaTranscriberLanguage.java new file mode 100644 index 0000000..dbdc9dd --- /dev/null +++ b/src/main/java/com/vapi/api/types/GladiaTranscriberLanguage.java @@ -0,0 +1,220 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum GladiaTranscriberLanguage { + AF("af"), + + SQ("sq"), + + AM("am"), + + AR("ar"), + + HY("hy"), + + AS("as"), + + AZ("az"), + + BA("ba"), + + EU("eu"), + + BE("be"), + + BN("bn"), + + BS("bs"), + + BR("br"), + + BG("bg"), + + CA("ca"), + + ZH("zh"), + + HR("hr"), + + CS("cs"), + + DA("da"), + + NL("nl"), + + EN("en"), + + ET("et"), + + FO("fo"), + + FI("fi"), + + FR("fr"), + + GL("gl"), + + KA("ka"), + + DE("de"), + + EL("el"), + + GU("gu"), + + HT("ht"), + + HA("ha"), + + HAW("haw"), + + HE("he"), + + HI("hi"), + + HU("hu"), + + IS("is"), + + ID("id"), + + IT("it"), + + JA("ja"), + + JP("jp"), + + JV("jv"), + + KN("kn"), + + KK("kk"), + + KM("km"), + + KO("ko"), + + LO("lo"), + + LA("la"), + + LV("lv"), + + LN("ln"), + + LT("lt"), + + LB("lb"), + + MK("mk"), + + MG("mg"), + + MS("ms"), + + ML("ml"), + + MT("mt"), + + MI("mi"), + + MR("mr"), + + MN("mn"), + + MYMR("mymr"), + + NE("ne"), + + NO("no"), + + NN("nn"), + + OC("oc"), + + PS("ps"), + + FA("fa"), + + PL("pl"), + + PT("pt"), + + PA("pa"), + + RO("ro"), + + RU("ru"), + + SA("sa"), + + SR("sr"), + + SN("sn"), + + SD("sd"), + + SI("si"), + + SK("sk"), + + SL("sl"), + + SO("so"), + + ES("es"), + + SU("su"), + + SW("sw"), + + SV("sv"), + + TL("tl"), + + TG("tg"), + + TA("ta"), + + TT("tt"), + + TE("te"), + + TH("th"), + + BO("bo"), + + TR("tr"), + + TK("tk"), + + UK("uk"), + + UR("ur"), + + UZ("uz"), + + VI("vi"), + + CY("cy"), + + YI("yi"), + + YO("yo"); + + private final String value; + + GladiaTranscriberLanguage(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/GladiaTranscriberLanguageBehaviour.java b/src/main/java/com/vapi/api/types/GladiaTranscriberLanguageBehaviour.java new file mode 100644 index 0000000..ded60c6 --- /dev/null +++ b/src/main/java/com/vapi/api/types/GladiaTranscriberLanguageBehaviour.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum GladiaTranscriberLanguageBehaviour { + MANUAL("manual"), + + AUTOMATIC_SINGLE_LANGUAGE("automatic single language"), + + AUTOMATIC_MULTIPLE_LANGUAGES("automatic multiple languages"); + + private final String value; + + GladiaTranscriberLanguageBehaviour(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/GladiaTranscriberModel.java b/src/main/java/com/vapi/api/types/GladiaTranscriberModel.java new file mode 100644 index 0000000..f4c9673 --- /dev/null +++ b/src/main/java/com/vapi/api/types/GladiaTranscriberModel.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum GladiaTranscriberModel { + FAST("fast"), + + ACCURATE("accurate"); + + private final String value; + + GladiaTranscriberModel(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/GoHighLevelCredential.java b/src/main/java/com/vapi/api/types/GoHighLevelCredential.java new file mode 100644 index 0000000..2d29fba --- /dev/null +++ b/src/main/java/com/vapi/api/types/GoHighLevelCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GoHighLevelCredential.Builder.class) +public final class GoHighLevelCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private GoHighLevelCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "gohighlevel"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GoHighLevelCredential && equalTo((GoHighLevelCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GoHighLevelCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(GoHighLevelCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + GoHighLevelCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GoHighLevelCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public GoHighLevelCredential build() { + return new GoHighLevelCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/GroqCredential.java b/src/main/java/com/vapi/api/types/GroqCredential.java new file mode 100644 index 0000000..9136fb2 --- /dev/null +++ b/src/main/java/com/vapi/api/types/GroqCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GroqCredential.Builder.class) +public final class GroqCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private GroqCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "groq"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GroqCredential && equalTo((GroqCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GroqCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(GroqCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + GroqCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GroqCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public GroqCredential build() { + return new GroqCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/GroqModel.java b/src/main/java/com/vapi/api/types/GroqModel.java new file mode 100644 index 0000000..1022f63 --- /dev/null +++ b/src/main/java/com/vapi/api/types/GroqModel.java @@ -0,0 +1,441 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GroqModel.Builder.class) +public final class GroqModel { + private final Optional> messages; + + private final Optional> tools; + + private final Optional> toolIds; + + private final GroqModelModel model; + + private final Optional temperature; + + private final Optional knowledgeBase; + + private final Optional maxTokens; + + private final Optional emotionRecognitionEnabled; + + private final Optional numFastTurns; + + private final Map additionalProperties; + + private GroqModel( + Optional> messages, + Optional> tools, + Optional> toolIds, + GroqModelModel model, + Optional temperature, + Optional knowledgeBase, + Optional maxTokens, + Optional emotionRecognitionEnabled, + Optional numFastTurns, + Map additionalProperties) { + this.messages = messages; + this.tools = tools; + this.toolIds = toolIds; + this.model = model; + this.temperature = temperature; + this.knowledgeBase = knowledgeBase; + this.maxTokens = maxTokens; + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + this.numFastTurns = numFastTurns; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the starting state for the conversation. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return These are the tools that the assistant can use during the call. To use existing tools, use toolIds. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("tools") + public Optional> getTools() { + return tools; + } + + /** + * @return These are the tools that the assistant can use during the call. To use transient tools, use tools. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("toolIds") + public Optional> getToolIds() { + return toolIds; + } + + /** + * @return This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + */ + @JsonProperty("model") + public GroqModelModel getModel() { + return model; + } + + /** + * @return This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + */ + @JsonProperty("temperature") + public Optional getTemperature() { + return temperature; + } + + /** + * @return These are the options for the knowledge base. + */ + @JsonProperty("knowledgeBase") + public Optional getKnowledgeBase() { + return knowledgeBase; + } + + /** + * @return This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. + */ + @JsonProperty("maxTokens") + public Optional getMaxTokens() { + return maxTokens; + } + + /** + * @return This determines whether we detect user's emotion while they speak and send it as an additional info to model. + *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ */ + @JsonProperty("emotionRecognitionEnabled") + public Optional getEmotionRecognitionEnabled() { + return emotionRecognitionEnabled; + } + + /** + * @return This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai. + *

Default is 0.

+ *

@default 0

+ */ + @JsonProperty("numFastTurns") + public Optional getNumFastTurns() { + return numFastTurns; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GroqModel && equalTo((GroqModel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GroqModel other) { + return messages.equals(other.messages) + && tools.equals(other.tools) + && toolIds.equals(other.toolIds) + && model.equals(other.model) + && temperature.equals(other.temperature) + && knowledgeBase.equals(other.knowledgeBase) + && maxTokens.equals(other.maxTokens) + && emotionRecognitionEnabled.equals(other.emotionRecognitionEnabled) + && numFastTurns.equals(other.numFastTurns); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.messages, + this.tools, + this.toolIds, + this.model, + this.temperature, + this.knowledgeBase, + this.maxTokens, + this.emotionRecognitionEnabled, + this.numFastTurns); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + _FinalStage model(@NotNull GroqModelModel model); + + Builder from(GroqModel other); + } + + public interface _FinalStage { + GroqModel build(); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage tools(Optional> tools); + + _FinalStage tools(List tools); + + _FinalStage toolIds(Optional> toolIds); + + _FinalStage toolIds(List toolIds); + + _FinalStage temperature(Optional temperature); + + _FinalStage temperature(Double temperature); + + _FinalStage knowledgeBase(Optional knowledgeBase); + + _FinalStage knowledgeBase(KnowledgeBase knowledgeBase); + + _FinalStage maxTokens(Optional maxTokens); + + _FinalStage maxTokens(Double maxTokens); + + _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled); + + _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled); + + _FinalStage numFastTurns(Optional numFastTurns); + + _FinalStage numFastTurns(Double numFastTurns); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, _FinalStage { + private GroqModelModel model; + + private Optional numFastTurns = Optional.empty(); + + private Optional emotionRecognitionEnabled = Optional.empty(); + + private Optional maxTokens = Optional.empty(); + + private Optional knowledgeBase = Optional.empty(); + + private Optional temperature = Optional.empty(); + + private Optional> toolIds = Optional.empty(); + + private Optional> tools = Optional.empty(); + + private Optional> messages = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GroqModel other) { + messages(other.getMessages()); + tools(other.getTools()); + toolIds(other.getToolIds()); + model(other.getModel()); + temperature(other.getTemperature()); + knowledgeBase(other.getKnowledgeBase()); + maxTokens(other.getMaxTokens()); + emotionRecognitionEnabled(other.getEmotionRecognitionEnabled()); + numFastTurns(other.getNumFastTurns()); + return this; + } + + /** + *

This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("model") + public _FinalStage model(@NotNull GroqModelModel model) { + this.model = Objects.requireNonNull(model, "model must not be null"); + return this; + } + + /** + *

This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai.

+ *

Default is 0.

+ *

@default 0

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numFastTurns(Double numFastTurns) { + this.numFastTurns = Optional.ofNullable(numFastTurns); + return this; + } + + @java.lang.Override + @JsonSetter(value = "numFastTurns", nulls = Nulls.SKIP) + public _FinalStage numFastTurns(Optional numFastTurns) { + this.numFastTurns = numFastTurns; + return this; + } + + /** + *

This determines whether we detect user's emotion while they speak and send it as an additional info to model.

+ *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = Optional.ofNullable(emotionRecognitionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "emotionRecognitionEnabled", nulls = Nulls.SKIP) + public _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + return this; + } + + /** + *

This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxTokens(Double maxTokens) { + this.maxTokens = Optional.ofNullable(maxTokens); + return this; + } + + @java.lang.Override + @JsonSetter(value = "maxTokens", nulls = Nulls.SKIP) + public _FinalStage maxTokens(Optional maxTokens) { + this.maxTokens = maxTokens; + return this; + } + + /** + *

These are the options for the knowledge base.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage knowledgeBase(KnowledgeBase knowledgeBase) { + this.knowledgeBase = Optional.ofNullable(knowledgeBase); + return this; + } + + @java.lang.Override + @JsonSetter(value = "knowledgeBase", nulls = Nulls.SKIP) + public _FinalStage knowledgeBase(Optional knowledgeBase) { + this.knowledgeBase = knowledgeBase; + return this; + } + + /** + *

This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage temperature(Double temperature) { + this.temperature = Optional.ofNullable(temperature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "temperature", nulls = Nulls.SKIP) + public _FinalStage temperature(Optional temperature) { + this.temperature = temperature; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use transient tools, use tools.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toolIds(List toolIds) { + this.toolIds = Optional.ofNullable(toolIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "toolIds", nulls = Nulls.SKIP) + public _FinalStage toolIds(Optional> toolIds) { + this.toolIds = toolIds; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use existing tools, use toolIds.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tools(List tools) { + this.tools = Optional.ofNullable(tools); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tools", nulls = Nulls.SKIP) + public _FinalStage tools(Optional> tools) { + this.tools = tools; + return this; + } + + /** + *

This is the starting state for the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + @java.lang.Override + public GroqModel build() { + return new GroqModel( + messages, + tools, + toolIds, + model, + temperature, + knowledgeBase, + maxTokens, + emotionRecognitionEnabled, + numFastTurns, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/GroqModelModel.java b/src/main/java/com/vapi/api/types/GroqModelModel.java new file mode 100644 index 0000000..5ea510c --- /dev/null +++ b/src/main/java/com/vapi/api/types/GroqModelModel.java @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum GroqModelModel { + LLAMA_31405_B_REASONING("llama-3.1-405b-reasoning"), + + LLAMA_3170_B_VERSATILE("llama-3.1-70b-versatile"), + + LLAMA_318_B_INSTANT("llama-3.1-8b-instant"), + + MIXTRAL_8_X_7_B_32768("mixtral-8x7b-32768"), + + LLAMA_38_B_8192("llama3-8b-8192"), + + LLAMA_370_B_8192("llama3-70b-8192"), + + LLAMA_3_GROQ_8_B_8192_TOOL_USE_PREVIEW("llama3-groq-8b-8192-tool-use-preview"), + + LLAMA_3_GROQ_70_B_8192_TOOL_USE_PREVIEW("llama3-groq-70b-8192-tool-use-preview"), + + GEMMA_7_B_IT("gemma-7b-it"), + + GEMMA_29_B_IT("gemma2-9b-it"); + + private final String value; + + GroqModelModel(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/GroqModelToolsItem.java b/src/main/java/com/vapi/api/types/GroqModelToolsItem.java new file mode 100644 index 0000000..bdac962 --- /dev/null +++ b/src/main/java/com/vapi/api/types/GroqModelToolsItem.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class GroqModelToolsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private GroqModelToolsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static GroqModelToolsItem dtmf(CreateDtmfToolDto value) { + return new GroqModelToolsItem(new DtmfValue(value)); + } + + public static GroqModelToolsItem endCall(CreateEndCallToolDto value) { + return new GroqModelToolsItem(new EndCallValue(value)); + } + + public static GroqModelToolsItem voicemail(CreateVoicemailToolDto value) { + return new GroqModelToolsItem(new VoicemailValue(value)); + } + + public static GroqModelToolsItem function(CreateFunctionToolDto value) { + return new GroqModelToolsItem(new FunctionValue(value)); + } + + public static GroqModelToolsItem ghl(CreateGhlToolDto value) { + return new GroqModelToolsItem(new GhlValue(value)); + } + + public static GroqModelToolsItem make(CreateMakeToolDto value) { + return new GroqModelToolsItem(new MakeValue(value)); + } + + public static GroqModelToolsItem transferCall(CreateTransferCallToolDto value) { + return new GroqModelToolsItem(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "GroqModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "GroqModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "GroqModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "GroqModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "GroqModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "GroqModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "GroqModelToolsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "GroqModelToolsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/HandoffStep.java b/src/main/java/com/vapi/api/types/HandoffStep.java new file mode 100644 index 0000000..4da4a73 --- /dev/null +++ b/src/main/java/com/vapi/api/types/HandoffStep.java @@ -0,0 +1,348 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = HandoffStep.Builder.class) +public final class HandoffStep { + private final Optional block; + + private final Optional> destinations; + + private final String name; + + private final Optional blockId; + + private final Optional> input; + + private final Map additionalProperties; + + private HandoffStep( + Optional block, + Optional> destinations, + String name, + Optional blockId, + Optional> input, + Map additionalProperties) { + this.block = block; + this.destinations = destinations; + this.name = name; + this.blockId = blockId; + this.input = input; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the block to use. To use an existing block, use blockId. + */ + @JsonProperty("block") + public Optional getBlock() { + return block; + } + + /** + * @return These are the destinations that the step can go to after it's done. + */ + @JsonProperty("destinations") + public Optional> getDestinations() { + return destinations; + } + + /** + * @return This is the name of the step. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return This is the id of the block to use. To use a transient block, use block. + */ + @JsonProperty("blockId") + public Optional getBlockId() { + return blockId; + } + + /** + * @return This is the input to the block. You can use any key-value map as input to the block. + *

Example: + * { + * "name": "John Doe", + * "age": 20 + * }

+ *

You can reference any variable in the context of the current block:

+ *
    + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • + *
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

Example: + * { + * "name": "{{my-tool-call-step.output.name}}", + * "age": "{{my-tool-call-step.input.age}}", + * "date": "{{workflow.input.date}}" + * }

+ *

You can dynamically change the key name.

+ *

Example: + * { + * "{{my-tool-call-step.output.key-name-for-name}}": "{{name}}", + * "{{my-tool-call-step.input.key-name-for-age}}": "{{age}}", + * "{{workflow.input.key-name-for-date}}": "{{date}}" + * }

+ *

You can represent the value as a string, number, boolean, array, or object.

+ *

Example: + * { + * "name": "john", + * "age": 20, + * "date": "2021-01-01", + * "metadata": { + * "unique-key": "{{my-tool-call-step.output.unique-key}}" + * }, + * "array": ["A", "B", "C"], + * }

+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow.
  4. + *
+ */ + @JsonProperty("input") + public Optional> getInput() { + return input; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof HandoffStep && equalTo((HandoffStep) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(HandoffStep other) { + return block.equals(other.block) + && destinations.equals(other.destinations) + && name.equals(other.name) + && blockId.equals(other.blockId) + && input.equals(other.input); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.block, this.destinations, this.name, this.blockId, this.input); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + + Builder from(HandoffStep other); + } + + public interface _FinalStage { + HandoffStep build(); + + _FinalStage block(Optional block); + + _FinalStage block(HandoffStepBlock block); + + _FinalStage destinations(Optional> destinations); + + _FinalStage destinations(List destinations); + + _FinalStage blockId(Optional blockId); + + _FinalStage blockId(String blockId); + + _FinalStage input(Optional> input); + + _FinalStage input(Map input); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + private Optional> input = Optional.empty(); + + private Optional blockId = Optional.empty(); + + private Optional> destinations = Optional.empty(); + + private Optional block = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(HandoffStep other) { + block(other.getBlock()); + destinations(other.getDestinations()); + name(other.getName()); + blockId(other.getBlockId()); + input(other.getInput()); + return this; + } + + /** + *

This is the name of the step.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

This is the input to the block. You can use any key-value map as input to the block.

+ *

Example: + * { + * "name": "John Doe", + * "age": 20 + * }

+ *

You can reference any variable in the context of the current block:

+ *
    + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • + *
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

Example: + * { + * "name": "{{my-tool-call-step.output.name}}", + * "age": "{{my-tool-call-step.input.age}}", + * "date": "{{workflow.input.date}}" + * }

+ *

You can dynamically change the key name.

+ *

Example: + * { + * "{{my-tool-call-step.output.key-name-for-name}}": "{{name}}", + * "{{my-tool-call-step.input.key-name-for-age}}": "{{age}}", + * "{{workflow.input.key-name-for-date}}": "{{date}}" + * }

+ *

You can represent the value as a string, number, boolean, array, or object.

+ *

Example: + * { + * "name": "john", + * "age": 20, + * "date": "2021-01-01", + * "metadata": { + * "unique-key": "{{my-tool-call-step.output.unique-key}}" + * }, + * "array": ["A", "B", "C"], + * }

+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow.
  4. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage input(Map input) { + this.input = Optional.ofNullable(input); + return this; + } + + @java.lang.Override + @JsonSetter(value = "input", nulls = Nulls.SKIP) + public _FinalStage input(Optional> input) { + this.input = input; + return this; + } + + /** + *

This is the id of the block to use. To use a transient block, use block.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage blockId(String blockId) { + this.blockId = Optional.ofNullable(blockId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "blockId", nulls = Nulls.SKIP) + public _FinalStage blockId(Optional blockId) { + this.blockId = blockId; + return this; + } + + /** + *

These are the destinations that the step can go to after it's done.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinations(List destinations) { + this.destinations = Optional.ofNullable(destinations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "destinations", nulls = Nulls.SKIP) + public _FinalStage destinations(Optional> destinations) { + this.destinations = destinations; + return this; + } + + /** + *

This is the block to use. To use an existing block, use blockId.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage block(HandoffStepBlock block) { + this.block = Optional.ofNullable(block); + return this; + } + + @java.lang.Override + @JsonSetter(value = "block", nulls = Nulls.SKIP) + public _FinalStage block(Optional block) { + this.block = block; + return this; + } + + @java.lang.Override + public HandoffStep build() { + return new HandoffStep(block, destinations, name, blockId, input, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/HandoffStepBlock.java b/src/main/java/com/vapi/api/types/HandoffStepBlock.java new file mode 100644 index 0000000..536c237 --- /dev/null +++ b/src/main/java/com/vapi/api/types/HandoffStepBlock.java @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class HandoffStepBlock { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private HandoffStepBlock(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static HandoffStepBlock conversation(CreateConversationBlockDto value) { + return new HandoffStepBlock(new ConversationValue(value)); + } + + public static HandoffStepBlock toolCall(CreateToolCallBlockDto value) { + return new HandoffStepBlock(new ToolCallValue(value)); + } + + public static HandoffStepBlock workflow(CreateWorkflowBlockDto value) { + return new HandoffStepBlock(new WorkflowValue(value)); + } + + public boolean isConversation() { + return value instanceof ConversationValue; + } + + public boolean isToolCall() { + return value instanceof ToolCallValue; + } + + public boolean isWorkflow() { + return value instanceof WorkflowValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getConversation() { + if (isConversation()) { + return Optional.of(((ConversationValue) value).value); + } + return Optional.empty(); + } + + public Optional getToolCall() { + if (isToolCall()) { + return Optional.of(((ToolCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getWorkflow() { + if (isWorkflow()) { + return Optional.of(((WorkflowValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitConversation(CreateConversationBlockDto conversation); + + T visitToolCall(CreateToolCallBlockDto toolCall); + + T visitWorkflow(CreateWorkflowBlockDto workflow); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ConversationValue.class), + @JsonSubTypes.Type(ToolCallValue.class), + @JsonSubTypes.Type(WorkflowValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("conversation") + private static final class ConversationValue implements Value { + @JsonUnwrapped + private CreateConversationBlockDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ConversationValue() {} + + private ConversationValue(CreateConversationBlockDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitConversation(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConversationValue && equalTo((ConversationValue) other); + } + + private boolean equalTo(ConversationValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "HandoffStepBlock{" + "value: " + value + "}"; + } + } + + @JsonTypeName("tool-call") + private static final class ToolCallValue implements Value { + @JsonUnwrapped + private CreateToolCallBlockDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ToolCallValue() {} + + private ToolCallValue(CreateToolCallBlockDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitToolCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallValue && equalTo((ToolCallValue) other); + } + + private boolean equalTo(ToolCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "HandoffStepBlock{" + "value: " + value + "}"; + } + } + + @JsonTypeName("workflow") + private static final class WorkflowValue implements Value { + @JsonUnwrapped + private CreateWorkflowBlockDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private WorkflowValue() {} + + private WorkflowValue(CreateWorkflowBlockDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitWorkflow(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkflowValue && equalTo((WorkflowValue) other); + } + + private boolean equalTo(WorkflowValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "HandoffStepBlock{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "HandoffStepBlock{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ImportTwilioPhoneNumberDto.java b/src/main/java/com/vapi/api/types/ImportTwilioPhoneNumberDto.java new file mode 100644 index 0000000..e327520 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ImportTwilioPhoneNumberDto.java @@ -0,0 +1,440 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ImportTwilioPhoneNumberDto.Builder.class) +public final class ImportTwilioPhoneNumberDto { + private final Optional fallbackDestination; + + private final String twilioPhoneNumber; + + private final String twilioAccountSid; + + private final String twilioAuthToken; + + private final Optional name; + + private final Optional assistantId; + + private final Optional squadId; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Map additionalProperties; + + private ImportTwilioPhoneNumberDto( + Optional fallbackDestination, + String twilioPhoneNumber, + String twilioAccountSid, + String twilioAuthToken, + Optional name, + Optional assistantId, + Optional squadId, + Optional serverUrl, + Optional serverUrlSecret, + Map additionalProperties) { + this.fallbackDestination = fallbackDestination; + this.twilioPhoneNumber = twilioPhoneNumber; + this.twilioAccountSid = twilioAccountSid; + this.twilioAuthToken = twilioAuthToken; + this.name = name; + this.assistantId = assistantId; + this.squadId = squadId; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the fallback destination an inbound call will be transferred to if: + *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ */ + @JsonProperty("fallbackDestination") + public Optional getFallbackDestination() { + return fallbackDestination; + } + + /** + * @return These are the digits of the phone number you own on your Twilio. + */ + @JsonProperty("twilioPhoneNumber") + public String getTwilioPhoneNumber() { + return twilioPhoneNumber; + } + + /** + * @return This is your Twilio Account SID that will be used to handle this phone number. + */ + @JsonProperty("twilioAccountSid") + public String getTwilioAccountSid() { + return twilioAccountSid; + } + + /** + * @return This is the Twilio Auth Token that will be used to handle this phone number. + */ + @JsonProperty("twilioAuthToken") + public String getTwilioAuthToken() { + return twilioAuthToken; + } + + /** + * @return This is the name of the phone number. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the assistant that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the squad that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message. + *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ImportTwilioPhoneNumberDto && equalTo((ImportTwilioPhoneNumberDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ImportTwilioPhoneNumberDto other) { + return fallbackDestination.equals(other.fallbackDestination) + && twilioPhoneNumber.equals(other.twilioPhoneNumber) + && twilioAccountSid.equals(other.twilioAccountSid) + && twilioAuthToken.equals(other.twilioAuthToken) + && name.equals(other.name) + && assistantId.equals(other.assistantId) + && squadId.equals(other.squadId) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fallbackDestination, + this.twilioPhoneNumber, + this.twilioAccountSid, + this.twilioAuthToken, + this.name, + this.assistantId, + this.squadId, + this.serverUrl, + this.serverUrlSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TwilioPhoneNumberStage builder() { + return new Builder(); + } + + public interface TwilioPhoneNumberStage { + TwilioAccountSidStage twilioPhoneNumber(@NotNull String twilioPhoneNumber); + + Builder from(ImportTwilioPhoneNumberDto other); + } + + public interface TwilioAccountSidStage { + TwilioAuthTokenStage twilioAccountSid(@NotNull String twilioAccountSid); + } + + public interface TwilioAuthTokenStage { + _FinalStage twilioAuthToken(@NotNull String twilioAuthToken); + } + + public interface _FinalStage { + ImportTwilioPhoneNumberDto build(); + + _FinalStage fallbackDestination(Optional fallbackDestination); + + _FinalStage fallbackDestination(ImportTwilioPhoneNumberDtoFallbackDestination fallbackDestination); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage assistantId(Optional assistantId); + + _FinalStage assistantId(String assistantId); + + _FinalStage squadId(Optional squadId); + + _FinalStage squadId(String squadId); + + _FinalStage serverUrl(Optional serverUrl); + + _FinalStage serverUrl(String serverUrl); + + _FinalStage serverUrlSecret(Optional serverUrlSecret); + + _FinalStage serverUrlSecret(String serverUrlSecret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements TwilioPhoneNumberStage, TwilioAccountSidStage, TwilioAuthTokenStage, _FinalStage { + private String twilioPhoneNumber; + + private String twilioAccountSid; + + private String twilioAuthToken; + + private Optional serverUrlSecret = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional fallbackDestination = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ImportTwilioPhoneNumberDto other) { + fallbackDestination(other.getFallbackDestination()); + twilioPhoneNumber(other.getTwilioPhoneNumber()); + twilioAccountSid(other.getTwilioAccountSid()); + twilioAuthToken(other.getTwilioAuthToken()); + name(other.getName()); + assistantId(other.getAssistantId()); + squadId(other.getSquadId()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + return this; + } + + /** + *

These are the digits of the phone number you own on your Twilio.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("twilioPhoneNumber") + public TwilioAccountSidStage twilioPhoneNumber(@NotNull String twilioPhoneNumber) { + this.twilioPhoneNumber = Objects.requireNonNull(twilioPhoneNumber, "twilioPhoneNumber must not be null"); + return this; + } + + /** + *

This is your Twilio Account SID that will be used to handle this phone number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("twilioAccountSid") + public TwilioAuthTokenStage twilioAccountSid(@NotNull String twilioAccountSid) { + this.twilioAccountSid = Objects.requireNonNull(twilioAccountSid, "twilioAccountSid must not be null"); + return this; + } + + /** + *

This is the Twilio Auth Token that will be used to handle this phone number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("twilioAuthToken") + public _FinalStage twilioAuthToken(@NotNull String twilioAuthToken) { + this.twilioAuthToken = Objects.requireNonNull(twilioAuthToken, "twilioAuthToken must not be null"); + return this; + } + + /** + *

This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret.

+ *

Same precedence logic as serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public _FinalStage serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + /** + *

This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message.

+ *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public _FinalStage serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + /** + *

This is the squad that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public _FinalStage squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + /** + *

This is the assistant that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public _FinalStage assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + /** + *

This is the name of the phone number. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the fallback destination an inbound call will be transferred to if:

+ *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fallbackDestination(ImportTwilioPhoneNumberDtoFallbackDestination fallbackDestination) { + this.fallbackDestination = Optional.ofNullable(fallbackDestination); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fallbackDestination", nulls = Nulls.SKIP) + public _FinalStage fallbackDestination( + Optional fallbackDestination) { + this.fallbackDestination = fallbackDestination; + return this; + } + + @java.lang.Override + public ImportTwilioPhoneNumberDto build() { + return new ImportTwilioPhoneNumberDto( + fallbackDestination, + twilioPhoneNumber, + twilioAccountSid, + twilioAuthToken, + name, + assistantId, + squadId, + serverUrl, + serverUrlSecret, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ImportTwilioPhoneNumberDtoFallbackDestination.java b/src/main/java/com/vapi/api/types/ImportTwilioPhoneNumberDtoFallbackDestination.java new file mode 100644 index 0000000..1412925 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ImportTwilioPhoneNumberDtoFallbackDestination.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ImportTwilioPhoneNumberDtoFallbackDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ImportTwilioPhoneNumberDtoFallbackDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ImportTwilioPhoneNumberDtoFallbackDestination number(TransferDestinationNumber value) { + return new ImportTwilioPhoneNumberDtoFallbackDestination(new NumberValue(value)); + } + + public static ImportTwilioPhoneNumberDtoFallbackDestination sip(TransferDestinationSip value) { + return new ImportTwilioPhoneNumberDtoFallbackDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ImportTwilioPhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ImportTwilioPhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ImportTwilioPhoneNumberDtoFallbackDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ImportVonagePhoneNumberDto.java b/src/main/java/com/vapi/api/types/ImportVonagePhoneNumberDto.java new file mode 100644 index 0000000..60decff --- /dev/null +++ b/src/main/java/com/vapi/api/types/ImportVonagePhoneNumberDto.java @@ -0,0 +1,408 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ImportVonagePhoneNumberDto.Builder.class) +public final class ImportVonagePhoneNumberDto { + private final Optional fallbackDestination; + + private final String vonagePhoneNumber; + + private final String credentialId; + + private final Optional name; + + private final Optional assistantId; + + private final Optional squadId; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Map additionalProperties; + + private ImportVonagePhoneNumberDto( + Optional fallbackDestination, + String vonagePhoneNumber, + String credentialId, + Optional name, + Optional assistantId, + Optional squadId, + Optional serverUrl, + Optional serverUrlSecret, + Map additionalProperties) { + this.fallbackDestination = fallbackDestination; + this.vonagePhoneNumber = vonagePhoneNumber; + this.credentialId = credentialId; + this.name = name; + this.assistantId = assistantId; + this.squadId = squadId; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the fallback destination an inbound call will be transferred to if: + *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ */ + @JsonProperty("fallbackDestination") + public Optional getFallbackDestination() { + return fallbackDestination; + } + + /** + * @return These are the digits of the phone number you own on your Vonage. + */ + @JsonProperty("vonagePhoneNumber") + public String getVonagePhoneNumber() { + return vonagePhoneNumber; + } + + /** + * @return This is the credential that is used to make outgoing calls, and do operations like call transfer and hang up. + *

You can add the Vonage Credential in the Provider Credentials page on the dashboard to get the credentialId.

+ */ + @JsonProperty("credentialId") + public String getCredentialId() { + return credentialId; + } + + /** + * @return This is the name of the phone number. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the assistant that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the squad that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message. + *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ImportVonagePhoneNumberDto && equalTo((ImportVonagePhoneNumberDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ImportVonagePhoneNumberDto other) { + return fallbackDestination.equals(other.fallbackDestination) + && vonagePhoneNumber.equals(other.vonagePhoneNumber) + && credentialId.equals(other.credentialId) + && name.equals(other.name) + && assistantId.equals(other.assistantId) + && squadId.equals(other.squadId) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fallbackDestination, + this.vonagePhoneNumber, + this.credentialId, + this.name, + this.assistantId, + this.squadId, + this.serverUrl, + this.serverUrlSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VonagePhoneNumberStage builder() { + return new Builder(); + } + + public interface VonagePhoneNumberStage { + CredentialIdStage vonagePhoneNumber(@NotNull String vonagePhoneNumber); + + Builder from(ImportVonagePhoneNumberDto other); + } + + public interface CredentialIdStage { + _FinalStage credentialId(@NotNull String credentialId); + } + + public interface _FinalStage { + ImportVonagePhoneNumberDto build(); + + _FinalStage fallbackDestination(Optional fallbackDestination); + + _FinalStage fallbackDestination(ImportVonagePhoneNumberDtoFallbackDestination fallbackDestination); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage assistantId(Optional assistantId); + + _FinalStage assistantId(String assistantId); + + _FinalStage squadId(Optional squadId); + + _FinalStage squadId(String squadId); + + _FinalStage serverUrl(Optional serverUrl); + + _FinalStage serverUrl(String serverUrl); + + _FinalStage serverUrlSecret(Optional serverUrlSecret); + + _FinalStage serverUrlSecret(String serverUrlSecret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VonagePhoneNumberStage, CredentialIdStage, _FinalStage { + private String vonagePhoneNumber; + + private String credentialId; + + private Optional serverUrlSecret = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional fallbackDestination = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ImportVonagePhoneNumberDto other) { + fallbackDestination(other.getFallbackDestination()); + vonagePhoneNumber(other.getVonagePhoneNumber()); + credentialId(other.getCredentialId()); + name(other.getName()); + assistantId(other.getAssistantId()); + squadId(other.getSquadId()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + return this; + } + + /** + *

These are the digits of the phone number you own on your Vonage.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("vonagePhoneNumber") + public CredentialIdStage vonagePhoneNumber(@NotNull String vonagePhoneNumber) { + this.vonagePhoneNumber = Objects.requireNonNull(vonagePhoneNumber, "vonagePhoneNumber must not be null"); + return this; + } + + /** + *

This is the credential that is used to make outgoing calls, and do operations like call transfer and hang up.

+ *

You can add the Vonage Credential in the Provider Credentials page on the dashboard to get the credentialId.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("credentialId") + public _FinalStage credentialId(@NotNull String credentialId) { + this.credentialId = Objects.requireNonNull(credentialId, "credentialId must not be null"); + return this; + } + + /** + *

This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret.

+ *

Same precedence logic as serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public _FinalStage serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + /** + *

This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message.

+ *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public _FinalStage serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + /** + *

This is the squad that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public _FinalStage squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + /** + *

This is the assistant that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public _FinalStage assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + /** + *

This is the name of the phone number. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the fallback destination an inbound call will be transferred to if:

+ *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fallbackDestination(ImportVonagePhoneNumberDtoFallbackDestination fallbackDestination) { + this.fallbackDestination = Optional.ofNullable(fallbackDestination); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fallbackDestination", nulls = Nulls.SKIP) + public _FinalStage fallbackDestination( + Optional fallbackDestination) { + this.fallbackDestination = fallbackDestination; + return this; + } + + @java.lang.Override + public ImportVonagePhoneNumberDto build() { + return new ImportVonagePhoneNumberDto( + fallbackDestination, + vonagePhoneNumber, + credentialId, + name, + assistantId, + squadId, + serverUrl, + serverUrlSecret, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ImportVonagePhoneNumberDtoFallbackDestination.java b/src/main/java/com/vapi/api/types/ImportVonagePhoneNumberDtoFallbackDestination.java new file mode 100644 index 0000000..2b5a93f --- /dev/null +++ b/src/main/java/com/vapi/api/types/ImportVonagePhoneNumberDtoFallbackDestination.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ImportVonagePhoneNumberDtoFallbackDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ImportVonagePhoneNumberDtoFallbackDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ImportVonagePhoneNumberDtoFallbackDestination number(TransferDestinationNumber value) { + return new ImportVonagePhoneNumberDtoFallbackDestination(new NumberValue(value)); + } + + public static ImportVonagePhoneNumberDtoFallbackDestination sip(TransferDestinationSip value) { + return new ImportVonagePhoneNumberDtoFallbackDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ImportVonagePhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ImportVonagePhoneNumberDtoFallbackDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ImportVonagePhoneNumberDtoFallbackDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/InviteUserDto.java b/src/main/java/com/vapi/api/types/InviteUserDto.java new file mode 100644 index 0000000..89ea880 --- /dev/null +++ b/src/main/java/com/vapi/api/types/InviteUserDto.java @@ -0,0 +1,124 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = InviteUserDto.Builder.class) +public final class InviteUserDto { + private final String email; + + private final InviteUserDtoRole role; + + private final Map additionalProperties; + + private InviteUserDto(String email, InviteUserDtoRole role, Map additionalProperties) { + this.email = email; + this.role = role; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("email") + public String getEmail() { + return email; + } + + @JsonProperty("role") + public InviteUserDtoRole getRole() { + return role; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof InviteUserDto && equalTo((InviteUserDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(InviteUserDto other) { + return email.equals(other.email) && role.equals(other.role); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.email, this.role); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EmailStage builder() { + return new Builder(); + } + + public interface EmailStage { + RoleStage email(@NotNull String email); + + Builder from(InviteUserDto other); + } + + public interface RoleStage { + _FinalStage role(@NotNull InviteUserDtoRole role); + } + + public interface _FinalStage { + InviteUserDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EmailStage, RoleStage, _FinalStage { + private String email; + + private InviteUserDtoRole role; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(InviteUserDto other) { + email(other.getEmail()); + role(other.getRole()); + return this; + } + + @java.lang.Override + @JsonSetter("email") + public RoleStage email(@NotNull String email) { + this.email = Objects.requireNonNull(email, "email must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("role") + public _FinalStage role(@NotNull InviteUserDtoRole role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + @java.lang.Override + public InviteUserDto build() { + return new InviteUserDto(email, role, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/InviteUserDtoRole.java b/src/main/java/com/vapi/api/types/InviteUserDtoRole.java new file mode 100644 index 0000000..7978d6b --- /dev/null +++ b/src/main/java/com/vapi/api/types/InviteUserDtoRole.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum InviteUserDtoRole { + ADMIN("admin"), + + EDITOR("editor"), + + VIEWER("viewer"); + + private final String value; + + InviteUserDtoRole(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/JsonSchema.java b/src/main/java/com/vapi/api/types/JsonSchema.java new file mode 100644 index 0000000..b90005a --- /dev/null +++ b/src/main/java/com/vapi/api/types/JsonSchema.java @@ -0,0 +1,276 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = JsonSchema.Builder.class) +public final class JsonSchema { + private final JsonSchemaType type; + + private final Optional> items; + + private final Optional> properties; + + private final Optional description; + + private final Optional> required; + + private final Map additionalProperties; + + private JsonSchema( + JsonSchemaType type, + Optional> items, + Optional> properties, + Optional description, + Optional> required, + Map additionalProperties) { + this.type = type; + this.items = items; + this.properties = properties; + this.description = description; + this.required = required; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the type of output you'd like. + *

string, number, integer, boolean are the primitive types and should be obvious.

+ *

array and object are more interesting and quite powerful. They allow you to define nested structures.

+ *

For array, you can define the schema of the items in the array using the items property.

+ *

For object, you can define the properties of the object using the properties property.

+ */ + @JsonProperty("type") + public JsonSchemaType getType() { + return type; + } + + /** + * @return This is required if the type is "array". This is the schema of the items in the array. + *

This is of type JsonSchema. However, Swagger doesn't support circular references.

+ */ + @JsonProperty("items") + public Optional> getItems() { + return items; + } + + /** + * @return This is required if the type is "object". This specifies the properties of the object. + *

This is a map of string to JsonSchema. However, Swagger doesn't support circular references.

+ */ + @JsonProperty("properties") + public Optional> getProperties() { + return properties; + } + + /** + * @return This is the description to help the model understand what it needs to output. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return This is a list of properties that are required. + *

This only makes sense if the type is "object".

+ */ + @JsonProperty("required") + public Optional> getRequired() { + return required; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof JsonSchema && equalTo((JsonSchema) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(JsonSchema other) { + return type.equals(other.type) + && items.equals(other.items) + && properties.equals(other.properties) + && description.equals(other.description) + && required.equals(other.required); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.items, this.properties, this.description, this.required); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + _FinalStage type(@NotNull JsonSchemaType type); + + Builder from(JsonSchema other); + } + + public interface _FinalStage { + JsonSchema build(); + + _FinalStage items(Optional> items); + + _FinalStage items(Map items); + + _FinalStage properties(Optional> properties); + + _FinalStage properties(Map properties); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage required(Optional> required); + + _FinalStage required(List required); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, _FinalStage { + private JsonSchemaType type; + + private Optional> required = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional> properties = Optional.empty(); + + private Optional> items = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(JsonSchema other) { + type(other.getType()); + items(other.getItems()); + properties(other.getProperties()); + description(other.getDescription()); + required(other.getRequired()); + return this; + } + + /** + *

This is the type of output you'd like.

+ *

string, number, integer, boolean are the primitive types and should be obvious.

+ *

array and object are more interesting and quite powerful. They allow you to define nested structures.

+ *

For array, you can define the schema of the items in the array using the items property.

+ *

For object, you can define the properties of the object using the properties property.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public _FinalStage type(@NotNull JsonSchemaType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

This is a list of properties that are required.

+ *

This only makes sense if the type is "object".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage required(List required) { + this.required = Optional.ofNullable(required); + return this; + } + + @java.lang.Override + @JsonSetter(value = "required", nulls = Nulls.SKIP) + public _FinalStage required(Optional> required) { + this.required = required; + return this; + } + + /** + *

This is the description to help the model understand what it needs to output.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

This is required if the type is "object". This specifies the properties of the object.

+ *

This is a map of string to JsonSchema. However, Swagger doesn't support circular references.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage properties(Map properties) { + this.properties = Optional.ofNullable(properties); + return this; + } + + @java.lang.Override + @JsonSetter(value = "properties", nulls = Nulls.SKIP) + public _FinalStage properties(Optional> properties) { + this.properties = properties; + return this; + } + + /** + *

This is required if the type is "array". This is the schema of the items in the array.

+ *

This is of type JsonSchema. However, Swagger doesn't support circular references.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage items(Map items) { + this.items = Optional.ofNullable(items); + return this; + } + + @java.lang.Override + @JsonSetter(value = "items", nulls = Nulls.SKIP) + public _FinalStage items(Optional> items) { + this.items = items; + return this; + } + + @java.lang.Override + public JsonSchema build() { + return new JsonSchema(type, items, properties, description, required, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/JsonSchemaType.java b/src/main/java/com/vapi/api/types/JsonSchemaType.java new file mode 100644 index 0000000..02be98e --- /dev/null +++ b/src/main/java/com/vapi/api/types/JsonSchemaType.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum JsonSchemaType { + STRING("string"), + + NUMBER("number"), + + INTEGER("integer"), + + BOOLEAN("boolean"), + + ARRAY("array"), + + OBJECT("object"); + + private final String value; + + JsonSchemaType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/KnowledgeBase.java b/src/main/java/com/vapi/api/types/KnowledgeBase.java new file mode 100644 index 0000000..cfc8f87 --- /dev/null +++ b/src/main/java/com/vapi/api/types/KnowledgeBase.java @@ -0,0 +1,130 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = KnowledgeBase.Builder.class) +public final class KnowledgeBase { + private final Optional topK; + + private final List fileIds; + + private final Map additionalProperties; + + private KnowledgeBase(Optional topK, List fileIds, Map additionalProperties) { + this.topK = topK; + this.fileIds = fileIds; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "canonical"; + } + + @JsonProperty("topK") + public Optional getTopK() { + return topK; + } + + @JsonProperty("fileIds") + public List getFileIds() { + return fileIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof KnowledgeBase && equalTo((KnowledgeBase) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(KnowledgeBase other) { + return topK.equals(other.topK) && fileIds.equals(other.fileIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.topK, this.fileIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional topK = Optional.empty(); + + private List fileIds = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(KnowledgeBase other) { + topK(other.getTopK()); + fileIds(other.getFileIds()); + return this; + } + + @JsonSetter(value = "topK", nulls = Nulls.SKIP) + public Builder topK(Optional topK) { + this.topK = topK; + return this; + } + + public Builder topK(Double topK) { + this.topK = Optional.ofNullable(topK); + return this; + } + + @JsonSetter(value = "fileIds", nulls = Nulls.SKIP) + public Builder fileIds(List fileIds) { + this.fileIds.clear(); + this.fileIds.addAll(fileIds); + return this; + } + + public Builder addFileIds(String fileIds) { + this.fileIds.add(fileIds); + return this; + } + + public Builder addAllFileIds(List fileIds) { + this.fileIds.addAll(fileIds); + return this; + } + + public KnowledgeBase build() { + return new KnowledgeBase(topK, fileIds, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/LmntCredential.java b/src/main/java/com/vapi/api/types/LmntCredential.java new file mode 100644 index 0000000..e6527d3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/LmntCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LmntCredential.Builder.class) +public final class LmntCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private LmntCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "lmnt"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LmntCredential && equalTo((LmntCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LmntCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(LmntCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + LmntCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LmntCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public LmntCredential build() { + return new LmntCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/LmntVoice.java b/src/main/java/com/vapi/api/types/LmntVoice.java new file mode 100644 index 0000000..651d5e2 --- /dev/null +++ b/src/main/java/com/vapi/api/types/LmntVoice.java @@ -0,0 +1,226 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LmntVoice.Builder.class) +public final class LmntVoice { + private final Optional fillerInjectionEnabled; + + private final LmntVoiceId voiceId; + + private final Optional speed; + + private final Optional chunkPlan; + + private final Map additionalProperties; + + private LmntVoice( + Optional fillerInjectionEnabled, + LmntVoiceId voiceId, + Optional speed, + Optional chunkPlan, + Map additionalProperties) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + this.voiceId = voiceId; + this.speed = speed; + this.chunkPlan = chunkPlan; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines whether fillers are injected into the model output before inputting it into the voice provider. + *

Default false because you can achieve better results with prompting the model.

+ */ + @JsonProperty("fillerInjectionEnabled") + public Optional getFillerInjectionEnabled() { + return fillerInjectionEnabled; + } + + /** + * @return This is the provider-specific ID that will be used. + */ + @JsonProperty("voiceId") + public LmntVoiceId getVoiceId() { + return voiceId; + } + + /** + * @return This is the speed multiplier that will be used. + */ + @JsonProperty("speed") + public Optional getSpeed() { + return speed; + } + + /** + * @return This is the plan for chunking the model output before it is sent to the voice provider. + */ + @JsonProperty("chunkPlan") + public Optional getChunkPlan() { + return chunkPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LmntVoice && equalTo((LmntVoice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LmntVoice other) { + return fillerInjectionEnabled.equals(other.fillerInjectionEnabled) + && voiceId.equals(other.voiceId) + && speed.equals(other.speed) + && chunkPlan.equals(other.chunkPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fillerInjectionEnabled, this.voiceId, this.speed, this.chunkPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VoiceIdStage builder() { + return new Builder(); + } + + public interface VoiceIdStage { + _FinalStage voiceId(@NotNull LmntVoiceId voiceId); + + Builder from(LmntVoice other); + } + + public interface _FinalStage { + LmntVoice build(); + + _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled); + + _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled); + + _FinalStage speed(Optional speed); + + _FinalStage speed(Double speed); + + _FinalStage chunkPlan(Optional chunkPlan); + + _FinalStage chunkPlan(ChunkPlan chunkPlan); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VoiceIdStage, _FinalStage { + private LmntVoiceId voiceId; + + private Optional chunkPlan = Optional.empty(); + + private Optional speed = Optional.empty(); + + private Optional fillerInjectionEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LmntVoice other) { + fillerInjectionEnabled(other.getFillerInjectionEnabled()); + voiceId(other.getVoiceId()); + speed(other.getSpeed()); + chunkPlan(other.getChunkPlan()); + return this; + } + + /** + *

This is the provider-specific ID that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("voiceId") + public _FinalStage voiceId(@NotNull LmntVoiceId voiceId) { + this.voiceId = Objects.requireNonNull(voiceId, "voiceId must not be null"); + return this; + } + + /** + *

This is the plan for chunking the model output before it is sent to the voice provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage chunkPlan(ChunkPlan chunkPlan) { + this.chunkPlan = Optional.ofNullable(chunkPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "chunkPlan", nulls = Nulls.SKIP) + public _FinalStage chunkPlan(Optional chunkPlan) { + this.chunkPlan = chunkPlan; + return this; + } + + /** + *

This is the speed multiplier that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage speed(Double speed) { + this.speed = Optional.ofNullable(speed); + return this; + } + + @java.lang.Override + @JsonSetter(value = "speed", nulls = Nulls.SKIP) + public _FinalStage speed(Optional speed) { + this.speed = speed; + return this; + } + + /** + *

This determines whether fillers are injected into the model output before inputting it into the voice provider.

+ *

Default false because you can achieve better results with prompting the model.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled) { + this.fillerInjectionEnabled = Optional.ofNullable(fillerInjectionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fillerInjectionEnabled", nulls = Nulls.SKIP) + public _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + return this; + } + + @java.lang.Override + public LmntVoice build() { + return new LmntVoice(fillerInjectionEnabled, voiceId, speed, chunkPlan, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/LmntVoiceId.java b/src/main/java/com/vapi/api/types/LmntVoiceId.java new file mode 100644 index 0000000..1fca88c --- /dev/null +++ b/src/main/java/com/vapi/api/types/LmntVoiceId.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.vapi.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = LmntVoiceId.Deserializer.class) +public final class LmntVoiceId { + private final Object value; + + private final int type; + + private LmntVoiceId(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((LmntVoiceIdEnum) this.value); + } else if (this.type == 1) { + return visitor.visit((String) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LmntVoiceId && equalTo((LmntVoiceId) other); + } + + private boolean equalTo(LmntVoiceId other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static LmntVoiceId of(LmntVoiceIdEnum value) { + return new LmntVoiceId(value, 0); + } + + public static LmntVoiceId of(String value) { + return new LmntVoiceId(value, 1); + } + + public interface Visitor { + T visit(LmntVoiceIdEnum value); + + T visit(String value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(LmntVoiceId.class); + } + + @java.lang.Override + public LmntVoiceId deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, LmntVoiceIdEnum.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (IllegalArgumentException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/vapi/api/types/LmntVoiceIdEnum.java b/src/main/java/com/vapi/api/types/LmntVoiceIdEnum.java new file mode 100644 index 0000000..96553b2 --- /dev/null +++ b/src/main/java/com/vapi/api/types/LmntVoiceIdEnum.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum LmntVoiceIdEnum { + LILY("lily"), + + DANIEL("daniel"); + + private final String value; + + LmntVoiceIdEnum(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/Log.java b/src/main/java/com/vapi/api/types/Log.java new file mode 100644 index 0000000..353eb30 --- /dev/null +++ b/src/main/java/com/vapi/api/types/Log.java @@ -0,0 +1,945 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Log.Builder.class) +public final class Log { + private final double time; + + private final String orgId; + + private final LogType type; + + private final Optional resource; + + private final double requestDurationSeconds; + + private final String requestStartedAt; + + private final String requestFinishedAt; + + private final Map requestBody; + + private final LogRequestHttpMethod requestHttpMethod; + + private final String requestUrl; + + private final String requestPath; + + private final Optional requestQuery; + + private final double responseHttpCode; + + private final Optional requestIpAddress; + + private final Optional requestOrigin; + + private final Optional> responseBody; + + private final Optional> requestHeaders; + + private final Optional error; + + private final Optional assistantId; + + private final Optional phoneNumberId; + + private final Optional customerId; + + private final Optional squadId; + + private final Optional callId; + + private final Map additionalProperties; + + private Log( + double time, + String orgId, + LogType type, + Optional resource, + double requestDurationSeconds, + String requestStartedAt, + String requestFinishedAt, + Map requestBody, + LogRequestHttpMethod requestHttpMethod, + String requestUrl, + String requestPath, + Optional requestQuery, + double responseHttpCode, + Optional requestIpAddress, + Optional requestOrigin, + Optional> responseBody, + Optional> requestHeaders, + Optional error, + Optional assistantId, + Optional phoneNumberId, + Optional customerId, + Optional squadId, + Optional callId, + Map additionalProperties) { + this.time = time; + this.orgId = orgId; + this.type = type; + this.resource = resource; + this.requestDurationSeconds = requestDurationSeconds; + this.requestStartedAt = requestStartedAt; + this.requestFinishedAt = requestFinishedAt; + this.requestBody = requestBody; + this.requestHttpMethod = requestHttpMethod; + this.requestUrl = requestUrl; + this.requestPath = requestPath; + this.requestQuery = requestQuery; + this.responseHttpCode = responseHttpCode; + this.requestIpAddress = requestIpAddress; + this.requestOrigin = requestOrigin; + this.responseBody = responseBody; + this.requestHeaders = requestHeaders; + this.error = error; + this.assistantId = assistantId; + this.phoneNumberId = phoneNumberId; + this.customerId = customerId; + this.squadId = squadId; + this.callId = callId; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the timestamp at which the log was written. + */ + @JsonProperty("time") + public double getTime() { + return time; + } + + /** + * @return This is the unique identifier for the org that this log belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the type of the log. + */ + @JsonProperty("type") + public LogType getType() { + return type; + } + + /** + * @return This is the specific resource, relevant only to API logs. + */ + @JsonProperty("resource") + public Optional getResource() { + return resource; + } + + /** + * @return 'This is how long the request took. + */ + @JsonProperty("requestDurationSeconds") + public double getRequestDurationSeconds() { + return requestDurationSeconds; + } + + /** + * @return This is the timestamp at which the request began. + */ + @JsonProperty("requestStartedAt") + public String getRequestStartedAt() { + return requestStartedAt; + } + + /** + * @return This is the timestamp at which the request finished. + */ + @JsonProperty("requestFinishedAt") + public String getRequestFinishedAt() { + return requestFinishedAt; + } + + /** + * @return This is the body of the request. + */ + @JsonProperty("requestBody") + public Map getRequestBody() { + return requestBody; + } + + /** + * @return This is the request method. + */ + @JsonProperty("requestHttpMethod") + public LogRequestHttpMethod getRequestHttpMethod() { + return requestHttpMethod; + } + + /** + * @return This is the request URL. + */ + @JsonProperty("requestUrl") + public String getRequestUrl() { + return requestUrl; + } + + /** + * @return This is the request path. + */ + @JsonProperty("requestPath") + public String getRequestPath() { + return requestPath; + } + + /** + * @return This is the request query. + */ + @JsonProperty("requestQuery") + public Optional getRequestQuery() { + return requestQuery; + } + + /** + * @return This the HTTP status code of the response. + */ + @JsonProperty("responseHttpCode") + public double getResponseHttpCode() { + return responseHttpCode; + } + + /** + * @return This is the request IP address. + */ + @JsonProperty("requestIpAddress") + public Optional getRequestIpAddress() { + return requestIpAddress; + } + + /** + * @return This is the origin of the request + */ + @JsonProperty("requestOrigin") + public Optional getRequestOrigin() { + return requestOrigin; + } + + /** + * @return This is the body of the response. + */ + @JsonProperty("responseBody") + public Optional> getResponseBody() { + return responseBody; + } + + /** + * @return These are the headers of the request. + */ + @JsonProperty("requestHeaders") + public Optional> getRequestHeaders() { + return requestHeaders; + } + + /** + * @return This is the error, if one occurred. + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + /** + * @return This is the ID of the assistant. + */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the ID of the phone number. + */ + @JsonProperty("phoneNumberId") + public Optional getPhoneNumberId() { + return phoneNumberId; + } + + /** + * @return This is the ID of the customer. + */ + @JsonProperty("customerId") + public Optional getCustomerId() { + return customerId; + } + + /** + * @return This is the ID of the squad. + */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is the ID of the call. + */ + @JsonProperty("callId") + public Optional getCallId() { + return callId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Log && equalTo((Log) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Log other) { + return time == other.time + && orgId.equals(other.orgId) + && type.equals(other.type) + && resource.equals(other.resource) + && requestDurationSeconds == other.requestDurationSeconds + && requestStartedAt.equals(other.requestStartedAt) + && requestFinishedAt.equals(other.requestFinishedAt) + && requestBody.equals(other.requestBody) + && requestHttpMethod.equals(other.requestHttpMethod) + && requestUrl.equals(other.requestUrl) + && requestPath.equals(other.requestPath) + && requestQuery.equals(other.requestQuery) + && responseHttpCode == other.responseHttpCode + && requestIpAddress.equals(other.requestIpAddress) + && requestOrigin.equals(other.requestOrigin) + && responseBody.equals(other.responseBody) + && requestHeaders.equals(other.requestHeaders) + && error.equals(other.error) + && assistantId.equals(other.assistantId) + && phoneNumberId.equals(other.phoneNumberId) + && customerId.equals(other.customerId) + && squadId.equals(other.squadId) + && callId.equals(other.callId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.time, + this.orgId, + this.type, + this.resource, + this.requestDurationSeconds, + this.requestStartedAt, + this.requestFinishedAt, + this.requestBody, + this.requestHttpMethod, + this.requestUrl, + this.requestPath, + this.requestQuery, + this.responseHttpCode, + this.requestIpAddress, + this.requestOrigin, + this.responseBody, + this.requestHeaders, + this.error, + this.assistantId, + this.phoneNumberId, + this.customerId, + this.squadId, + this.callId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TimeStage builder() { + return new Builder(); + } + + public interface TimeStage { + OrgIdStage time(double time); + + Builder from(Log other); + } + + public interface OrgIdStage { + TypeStage orgId(@NotNull String orgId); + } + + public interface TypeStage { + RequestDurationSecondsStage type(@NotNull LogType type); + } + + public interface RequestDurationSecondsStage { + RequestStartedAtStage requestDurationSeconds(double requestDurationSeconds); + } + + public interface RequestStartedAtStage { + RequestFinishedAtStage requestStartedAt(@NotNull String requestStartedAt); + } + + public interface RequestFinishedAtStage { + RequestHttpMethodStage requestFinishedAt(@NotNull String requestFinishedAt); + } + + public interface RequestHttpMethodStage { + RequestUrlStage requestHttpMethod(@NotNull LogRequestHttpMethod requestHttpMethod); + } + + public interface RequestUrlStage { + RequestPathStage requestUrl(@NotNull String requestUrl); + } + + public interface RequestPathStage { + ResponseHttpCodeStage requestPath(@NotNull String requestPath); + } + + public interface ResponseHttpCodeStage { + _FinalStage responseHttpCode(double responseHttpCode); + } + + public interface _FinalStage { + Log build(); + + _FinalStage resource(Optional resource); + + _FinalStage resource(LogResource resource); + + _FinalStage requestBody(Map requestBody); + + _FinalStage putAllRequestBody(Map requestBody); + + _FinalStage requestBody(String key, Object value); + + _FinalStage requestQuery(Optional requestQuery); + + _FinalStage requestQuery(String requestQuery); + + _FinalStage requestIpAddress(Optional requestIpAddress); + + _FinalStage requestIpAddress(String requestIpAddress); + + _FinalStage requestOrigin(Optional requestOrigin); + + _FinalStage requestOrigin(String requestOrigin); + + _FinalStage responseBody(Optional> responseBody); + + _FinalStage responseBody(Map responseBody); + + _FinalStage requestHeaders(Optional> requestHeaders); + + _FinalStage requestHeaders(Map requestHeaders); + + _FinalStage error(Optional error); + + _FinalStage error(Error error); + + _FinalStage assistantId(Optional assistantId); + + _FinalStage assistantId(String assistantId); + + _FinalStage phoneNumberId(Optional phoneNumberId); + + _FinalStage phoneNumberId(String phoneNumberId); + + _FinalStage customerId(Optional customerId); + + _FinalStage customerId(String customerId); + + _FinalStage squadId(Optional squadId); + + _FinalStage squadId(String squadId); + + _FinalStage callId(Optional callId); + + _FinalStage callId(String callId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements TimeStage, + OrgIdStage, + TypeStage, + RequestDurationSecondsStage, + RequestStartedAtStage, + RequestFinishedAtStage, + RequestHttpMethodStage, + RequestUrlStage, + RequestPathStage, + ResponseHttpCodeStage, + _FinalStage { + private double time; + + private String orgId; + + private LogType type; + + private double requestDurationSeconds; + + private String requestStartedAt; + + private String requestFinishedAt; + + private LogRequestHttpMethod requestHttpMethod; + + private String requestUrl; + + private String requestPath; + + private double responseHttpCode; + + private Optional callId = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional customerId = Optional.empty(); + + private Optional phoneNumberId = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional> requestHeaders = Optional.empty(); + + private Optional> responseBody = Optional.empty(); + + private Optional requestOrigin = Optional.empty(); + + private Optional requestIpAddress = Optional.empty(); + + private Optional requestQuery = Optional.empty(); + + private Map requestBody = new LinkedHashMap<>(); + + private Optional resource = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Log other) { + time(other.getTime()); + orgId(other.getOrgId()); + type(other.getType()); + resource(other.getResource()); + requestDurationSeconds(other.getRequestDurationSeconds()); + requestStartedAt(other.getRequestStartedAt()); + requestFinishedAt(other.getRequestFinishedAt()); + requestBody(other.getRequestBody()); + requestHttpMethod(other.getRequestHttpMethod()); + requestUrl(other.getRequestUrl()); + requestPath(other.getRequestPath()); + requestQuery(other.getRequestQuery()); + responseHttpCode(other.getResponseHttpCode()); + requestIpAddress(other.getRequestIpAddress()); + requestOrigin(other.getRequestOrigin()); + responseBody(other.getResponseBody()); + requestHeaders(other.getRequestHeaders()); + error(other.getError()); + assistantId(other.getAssistantId()); + phoneNumberId(other.getPhoneNumberId()); + customerId(other.getCustomerId()); + squadId(other.getSquadId()); + callId(other.getCallId()); + return this; + } + + /** + *

This is the timestamp at which the log was written.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("time") + public OrgIdStage time(double time) { + this.time = time; + return this; + } + + /** + *

This is the unique identifier for the org that this log belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public TypeStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the type of the log.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public RequestDurationSecondsStage type(@NotNull LogType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

'This is how long the request took.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("requestDurationSeconds") + public RequestStartedAtStage requestDurationSeconds(double requestDurationSeconds) { + this.requestDurationSeconds = requestDurationSeconds; + return this; + } + + /** + *

This is the timestamp at which the request began.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("requestStartedAt") + public RequestFinishedAtStage requestStartedAt(@NotNull String requestStartedAt) { + this.requestStartedAt = Objects.requireNonNull(requestStartedAt, "requestStartedAt must not be null"); + return this; + } + + /** + *

This is the timestamp at which the request finished.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("requestFinishedAt") + public RequestHttpMethodStage requestFinishedAt(@NotNull String requestFinishedAt) { + this.requestFinishedAt = Objects.requireNonNull(requestFinishedAt, "requestFinishedAt must not be null"); + return this; + } + + /** + *

This is the request method.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("requestHttpMethod") + public RequestUrlStage requestHttpMethod(@NotNull LogRequestHttpMethod requestHttpMethod) { + this.requestHttpMethod = Objects.requireNonNull(requestHttpMethod, "requestHttpMethod must not be null"); + return this; + } + + /** + *

This is the request URL.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("requestUrl") + public RequestPathStage requestUrl(@NotNull String requestUrl) { + this.requestUrl = Objects.requireNonNull(requestUrl, "requestUrl must not be null"); + return this; + } + + /** + *

This is the request path.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("requestPath") + public ResponseHttpCodeStage requestPath(@NotNull String requestPath) { + this.requestPath = Objects.requireNonNull(requestPath, "requestPath must not be null"); + return this; + } + + /** + *

This the HTTP status code of the response.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("responseHttpCode") + public _FinalStage responseHttpCode(double responseHttpCode) { + this.responseHttpCode = responseHttpCode; + return this; + } + + /** + *

This is the ID of the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage callId(String callId) { + this.callId = Optional.ofNullable(callId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "callId", nulls = Nulls.SKIP) + public _FinalStage callId(Optional callId) { + this.callId = callId; + return this; + } + + /** + *

This is the ID of the squad.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public _FinalStage squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + /** + *

This is the ID of the customer.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customerId(String customerId) { + this.customerId = Optional.ofNullable(customerId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "customerId", nulls = Nulls.SKIP) + public _FinalStage customerId(Optional customerId) { + this.customerId = customerId; + return this; + } + + /** + *

This is the ID of the phone number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneNumberId(String phoneNumberId) { + this.phoneNumberId = Optional.ofNullable(phoneNumberId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phoneNumberId", nulls = Nulls.SKIP) + public _FinalStage phoneNumberId(Optional phoneNumberId) { + this.phoneNumberId = phoneNumberId; + return this; + } + + /** + *

This is the ID of the assistant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public _FinalStage assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + /** + *

This is the error, if one occurred.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(Error error) { + this.error = Optional.ofNullable(error); + return this; + } + + @java.lang.Override + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public _FinalStage error(Optional error) { + this.error = error; + return this; + } + + /** + *

These are the headers of the request.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requestHeaders(Map requestHeaders) { + this.requestHeaders = Optional.ofNullable(requestHeaders); + return this; + } + + @java.lang.Override + @JsonSetter(value = "requestHeaders", nulls = Nulls.SKIP) + public _FinalStage requestHeaders(Optional> requestHeaders) { + this.requestHeaders = requestHeaders; + return this; + } + + /** + *

This is the body of the response.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage responseBody(Map responseBody) { + this.responseBody = Optional.ofNullable(responseBody); + return this; + } + + @java.lang.Override + @JsonSetter(value = "responseBody", nulls = Nulls.SKIP) + public _FinalStage responseBody(Optional> responseBody) { + this.responseBody = responseBody; + return this; + } + + /** + *

This is the origin of the request

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requestOrigin(String requestOrigin) { + this.requestOrigin = Optional.ofNullable(requestOrigin); + return this; + } + + @java.lang.Override + @JsonSetter(value = "requestOrigin", nulls = Nulls.SKIP) + public _FinalStage requestOrigin(Optional requestOrigin) { + this.requestOrigin = requestOrigin; + return this; + } + + /** + *

This is the request IP address.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requestIpAddress(String requestIpAddress) { + this.requestIpAddress = Optional.ofNullable(requestIpAddress); + return this; + } + + @java.lang.Override + @JsonSetter(value = "requestIpAddress", nulls = Nulls.SKIP) + public _FinalStage requestIpAddress(Optional requestIpAddress) { + this.requestIpAddress = requestIpAddress; + return this; + } + + /** + *

This is the request query.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requestQuery(String requestQuery) { + this.requestQuery = Optional.ofNullable(requestQuery); + return this; + } + + @java.lang.Override + @JsonSetter(value = "requestQuery", nulls = Nulls.SKIP) + public _FinalStage requestQuery(Optional requestQuery) { + this.requestQuery = requestQuery; + return this; + } + + /** + *

This is the body of the request.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage requestBody(String key, Object value) { + this.requestBody.put(key, value); + return this; + } + + /** + *

This is the body of the request.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllRequestBody(Map requestBody) { + this.requestBody.putAll(requestBody); + return this; + } + + @java.lang.Override + @JsonSetter(value = "requestBody", nulls = Nulls.SKIP) + public _FinalStage requestBody(Map requestBody) { + this.requestBody.clear(); + this.requestBody.putAll(requestBody); + return this; + } + + /** + *

This is the specific resource, relevant only to API logs.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage resource(LogResource resource) { + this.resource = Optional.ofNullable(resource); + return this; + } + + @java.lang.Override + @JsonSetter(value = "resource", nulls = Nulls.SKIP) + public _FinalStage resource(Optional resource) { + this.resource = resource; + return this; + } + + @java.lang.Override + public Log build() { + return new Log( + time, + orgId, + type, + resource, + requestDurationSeconds, + requestStartedAt, + requestFinishedAt, + requestBody, + requestHttpMethod, + requestUrl, + requestPath, + requestQuery, + responseHttpCode, + requestIpAddress, + requestOrigin, + responseBody, + requestHeaders, + error, + assistantId, + phoneNumberId, + customerId, + squadId, + callId, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/LogRequestHttpMethod.java b/src/main/java/com/vapi/api/types/LogRequestHttpMethod.java new file mode 100644 index 0000000..dc998e6 --- /dev/null +++ b/src/main/java/com/vapi/api/types/LogRequestHttpMethod.java @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum LogRequestHttpMethod { + POST("POST"), + + GET("GET"), + + PUT("PUT"), + + PATCH("PATCH"), + + DELETE("DELETE"); + + private final String value; + + LogRequestHttpMethod(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/LogResource.java b/src/main/java/com/vapi/api/types/LogResource.java new file mode 100644 index 0000000..c7b6d38 --- /dev/null +++ b/src/main/java/com/vapi/api/types/LogResource.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum LogResource { + ASSISTANT("assistant"), + + PHONE_NUMBER("phone-number"), + + TOOL("tool"), + + SQUAD("squad"), + + CALL("call"), + + FILE("file"), + + METRIC("metric"), + + LOG("log"); + + private final String value; + + LogResource(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/LogType.java b/src/main/java/com/vapi/api/types/LogType.java new file mode 100644 index 0000000..64df80c --- /dev/null +++ b/src/main/java/com/vapi/api/types/LogType.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum LogType { + API("API"), + + WEBHOOK("Webhook"), + + CALL("Call"), + + PROVIDER("Provider"); + + private final String value; + + LogType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/LogsPaginatedResponse.java b/src/main/java/com/vapi/api/types/LogsPaginatedResponse.java new file mode 100644 index 0000000..c00b443 --- /dev/null +++ b/src/main/java/com/vapi/api/types/LogsPaginatedResponse.java @@ -0,0 +1,143 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = LogsPaginatedResponse.Builder.class) +public final class LogsPaginatedResponse { + private final List results; + + private final PaginationMeta metadata; + + private final Map additionalProperties; + + private LogsPaginatedResponse( + List results, PaginationMeta metadata, Map additionalProperties) { + this.results = results; + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("results") + public List getResults() { + return results; + } + + @JsonProperty("metadata") + public PaginationMeta getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LogsPaginatedResponse && equalTo((LogsPaginatedResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(LogsPaginatedResponse other) { + return results.equals(other.results) && metadata.equals(other.metadata); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.results, this.metadata); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MetadataStage builder() { + return new Builder(); + } + + public interface MetadataStage { + _FinalStage metadata(@NotNull PaginationMeta metadata); + + Builder from(LogsPaginatedResponse other); + } + + public interface _FinalStage { + LogsPaginatedResponse build(); + + _FinalStage results(List results); + + _FinalStage addResults(Log results); + + _FinalStage addAllResults(List results); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MetadataStage, _FinalStage { + private PaginationMeta metadata; + + private List results = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(LogsPaginatedResponse other) { + results(other.getResults()); + metadata(other.getMetadata()); + return this; + } + + @java.lang.Override + @JsonSetter("metadata") + public _FinalStage metadata(@NotNull PaginationMeta metadata) { + this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllResults(List results) { + this.results.addAll(results); + return this; + } + + @java.lang.Override + public _FinalStage addResults(Log results) { + this.results.add(results); + return this; + } + + @java.lang.Override + @JsonSetter(value = "results", nulls = Nulls.SKIP) + public _FinalStage results(List results) { + this.results.clear(); + this.results.addAll(results); + return this; + } + + @java.lang.Override + public LogsPaginatedResponse build() { + return new LogsPaginatedResponse(results, metadata, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/MakeCredential.java b/src/main/java/com/vapi/api/types/MakeCredential.java new file mode 100644 index 0000000..407d3d3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/MakeCredential.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MakeCredential.Builder.class) +public final class MakeCredential { + private final String teamId; + + private final String region; + + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private MakeCredential( + String teamId, + String region, + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.teamId = teamId; + this.region = region; + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "make"; + } + + /** + * @return Team ID + */ + @JsonProperty("teamId") + public String getTeamId() { + return teamId; + } + + /** + * @return Region of your application. For example: eu1, eu2, us1, us2 + */ + @JsonProperty("region") + public String getRegion() { + return region; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeCredential && equalTo((MakeCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MakeCredential other) { + return teamId.equals(other.teamId) + && region.equals(other.region) + && apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.teamId, this.region, this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TeamIdStage builder() { + return new Builder(); + } + + public interface TeamIdStage { + RegionStage teamId(@NotNull String teamId); + + Builder from(MakeCredential other); + } + + public interface RegionStage { + ApiKeyStage region(@NotNull String region); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + MakeCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements TeamIdStage, + RegionStage, + ApiKeyStage, + IdStage, + OrgIdStage, + CreatedAtStage, + UpdatedAtStage, + _FinalStage { + private String teamId; + + private String region; + + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MakeCredential other) { + teamId(other.getTeamId()); + region(other.getRegion()); + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

Team ID

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("teamId") + public RegionStage teamId(@NotNull String teamId) { + this.teamId = Objects.requireNonNull(teamId, "teamId must not be null"); + return this; + } + + /** + *

Region of your application. For example: eu1, eu2, us1, us2

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("region") + public ApiKeyStage region(@NotNull String region) { + this.region = Objects.requireNonNull(region, "region must not be null"); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public MakeCredential build() { + return new MakeCredential(teamId, region, apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/MakeTool.java b/src/main/java/com/vapi/api/types/MakeTool.java new file mode 100644 index 0000000..d409477 --- /dev/null +++ b/src/main/java/com/vapi/api/types/MakeTool.java @@ -0,0 +1,407 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MakeTool.Builder.class) +public final class MakeTool { + private final Optional async; + + private final Optional> messages; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional function; + + private final Optional server; + + private final MakeToolMetadata metadata; + + private final Map additionalProperties; + + private MakeTool( + Optional async, + Optional> messages, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional function, + Optional server, + MakeToolMetadata metadata, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.function = function; + this.server = server; + this.metadata = metadata; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the unique identifier for the tool. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the organization that this tool belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the tool was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the tool was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @JsonProperty("metadata") + public MakeToolMetadata getMetadata() { + return metadata; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeTool && equalTo((MakeTool) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MakeTool other) { + return async.equals(other.async) + && messages.equals(other.messages) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && function.equals(other.function) + && server.equals(other.server) + && metadata.equals(other.metadata); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.async, + this.messages, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.function, + this.server, + this.metadata); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(MakeTool other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface MetadataStage { + _FinalStage metadata(@NotNull MakeToolMetadata metadata); + } + + public interface _FinalStage { + MakeTool build(); + + _FinalStage async(Optional async); + + _FinalStage async(Boolean async); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage function(Optional function); + + _FinalStage function(OpenAiFunction function); + + _FinalStage server(Optional server); + + _FinalStage server(Server server); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, MetadataStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private MakeToolMetadata metadata; + + private Optional server = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional async = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MakeTool other) { + async(other.getAsync()); + messages(other.getMessages()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + function(other.getFunction()); + server(other.getServer()); + metadata(other.getMetadata()); + return this; + } + + /** + *

This is the unique identifier for the tool.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the organization that this tool belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the tool was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the tool was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("metadata") + public _FinalStage metadata(@NotNull MakeToolMetadata metadata) { + this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); + return this; + } + + /** + *

This is the server that will be hit when this tool is requested by the model.

+ *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + @java.lang.Override + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public _FinalStage server(Optional server) { + this.server = server; + return this; + } + + /** + *

This is the function definition of the tool.

+ *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @java.lang.Override + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public _FinalStage function(Optional function) { + this.function = function; + return this; + } + + /** + *

These are the messages that will be spoken to the user as the tool is running.

+ *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + /** + *

This determines if the tool is async.

+ *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @java.lang.Override + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public _FinalStage async(Optional async) { + this.async = async; + return this; + } + + @java.lang.Override + public MakeTool build() { + return new MakeTool( + async, messages, id, orgId, createdAt, updatedAt, function, server, metadata, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/MakeToolMessagesItem.java b/src/main/java/com/vapi/api/types/MakeToolMessagesItem.java new file mode 100644 index 0000000..f9d4e0f --- /dev/null +++ b/src/main/java/com/vapi/api/types/MakeToolMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class MakeToolMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private MakeToolMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static MakeToolMessagesItem requestStart(ToolMessageStart value) { + return new MakeToolMessagesItem(new RequestStartValue(value)); + } + + public static MakeToolMessagesItem requestComplete(ToolMessageComplete value) { + return new MakeToolMessagesItem(new RequestCompleteValue(value)); + } + + public static MakeToolMessagesItem requestFailed(ToolMessageFailed value) { + return new MakeToolMessagesItem(new RequestFailedValue(value)); + } + + public static MakeToolMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new MakeToolMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "MakeToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "MakeToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "MakeToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "MakeToolMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "MakeToolMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/MakeToolMetadata.java b/src/main/java/com/vapi/api/types/MakeToolMetadata.java new file mode 100644 index 0000000..304ab63 --- /dev/null +++ b/src/main/java/com/vapi/api/types/MakeToolMetadata.java @@ -0,0 +1,118 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MakeToolMetadata.Builder.class) +public final class MakeToolMetadata { + private final Optional scenarioId; + + private final Optional triggerHookId; + + private final Map additionalProperties; + + private MakeToolMetadata( + Optional scenarioId, Optional triggerHookId, Map additionalProperties) { + this.scenarioId = scenarioId; + this.triggerHookId = triggerHookId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("scenarioId") + public Optional getScenarioId() { + return scenarioId; + } + + @JsonProperty("triggerHookId") + public Optional getTriggerHookId() { + return triggerHookId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeToolMetadata && equalTo((MakeToolMetadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MakeToolMetadata other) { + return scenarioId.equals(other.scenarioId) && triggerHookId.equals(other.triggerHookId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.scenarioId, this.triggerHookId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional scenarioId = Optional.empty(); + + private Optional triggerHookId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MakeToolMetadata other) { + scenarioId(other.getScenarioId()); + triggerHookId(other.getTriggerHookId()); + return this; + } + + @JsonSetter(value = "scenarioId", nulls = Nulls.SKIP) + public Builder scenarioId(Optional scenarioId) { + this.scenarioId = scenarioId; + return this; + } + + public Builder scenarioId(Double scenarioId) { + this.scenarioId = Optional.ofNullable(scenarioId); + return this; + } + + @JsonSetter(value = "triggerHookId", nulls = Nulls.SKIP) + public Builder triggerHookId(Optional triggerHookId) { + this.triggerHookId = triggerHookId; + return this; + } + + public Builder triggerHookId(Double triggerHookId) { + this.triggerHookId = Optional.ofNullable(triggerHookId); + return this; + } + + public MakeToolMetadata build() { + return new MakeToolMetadata(scenarioId, triggerHookId, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/MakeToolProviderDetails.java b/src/main/java/com/vapi/api/types/MakeToolProviderDetails.java new file mode 100644 index 0000000..1ac6248 --- /dev/null +++ b/src/main/java/com/vapi/api/types/MakeToolProviderDetails.java @@ -0,0 +1,234 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MakeToolProviderDetails.Builder.class) +public final class MakeToolProviderDetails { + private final Optional templateUrl; + + private final Optional> setupInstructions; + + private final Optional scenarioId; + + private final Optional scenarioName; + + private final Optional triggerHookId; + + private final Optional triggerHookName; + + private final Map additionalProperties; + + private MakeToolProviderDetails( + Optional templateUrl, + Optional> setupInstructions, + Optional scenarioId, + Optional scenarioName, + Optional triggerHookId, + Optional triggerHookName, + Map additionalProperties) { + this.templateUrl = templateUrl; + this.setupInstructions = setupInstructions; + this.scenarioId = scenarioId; + this.scenarioName = scenarioName; + this.triggerHookId = triggerHookId; + this.triggerHookName = triggerHookName; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the Template URL or the Snapshot URL corresponding to the Template. + */ + @JsonProperty("templateUrl") + public Optional getTemplateUrl() { + return templateUrl; + } + + @JsonProperty("setupInstructions") + public Optional> getSetupInstructions() { + return setupInstructions; + } + + @JsonProperty("scenarioId") + public Optional getScenarioId() { + return scenarioId; + } + + @JsonProperty("scenarioName") + public Optional getScenarioName() { + return scenarioName; + } + + @JsonProperty("triggerHookId") + public Optional getTriggerHookId() { + return triggerHookId; + } + + @JsonProperty("triggerHookName") + public Optional getTriggerHookName() { + return triggerHookName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeToolProviderDetails && equalTo((MakeToolProviderDetails) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MakeToolProviderDetails other) { + return templateUrl.equals(other.templateUrl) + && setupInstructions.equals(other.setupInstructions) + && scenarioId.equals(other.scenarioId) + && scenarioName.equals(other.scenarioName) + && triggerHookId.equals(other.triggerHookId) + && triggerHookName.equals(other.triggerHookName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.templateUrl, + this.setupInstructions, + this.scenarioId, + this.scenarioName, + this.triggerHookId, + this.triggerHookName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional templateUrl = Optional.empty(); + + private Optional> setupInstructions = Optional.empty(); + + private Optional scenarioId = Optional.empty(); + + private Optional scenarioName = Optional.empty(); + + private Optional triggerHookId = Optional.empty(); + + private Optional triggerHookName = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MakeToolProviderDetails other) { + templateUrl(other.getTemplateUrl()); + setupInstructions(other.getSetupInstructions()); + scenarioId(other.getScenarioId()); + scenarioName(other.getScenarioName()); + triggerHookId(other.getTriggerHookId()); + triggerHookName(other.getTriggerHookName()); + return this; + } + + @JsonSetter(value = "templateUrl", nulls = Nulls.SKIP) + public Builder templateUrl(Optional templateUrl) { + this.templateUrl = templateUrl; + return this; + } + + public Builder templateUrl(String templateUrl) { + this.templateUrl = Optional.ofNullable(templateUrl); + return this; + } + + @JsonSetter(value = "setupInstructions", nulls = Nulls.SKIP) + public Builder setupInstructions(Optional> setupInstructions) { + this.setupInstructions = setupInstructions; + return this; + } + + public Builder setupInstructions(List setupInstructions) { + this.setupInstructions = Optional.ofNullable(setupInstructions); + return this; + } + + @JsonSetter(value = "scenarioId", nulls = Nulls.SKIP) + public Builder scenarioId(Optional scenarioId) { + this.scenarioId = scenarioId; + return this; + } + + public Builder scenarioId(Double scenarioId) { + this.scenarioId = Optional.ofNullable(scenarioId); + return this; + } + + @JsonSetter(value = "scenarioName", nulls = Nulls.SKIP) + public Builder scenarioName(Optional scenarioName) { + this.scenarioName = scenarioName; + return this; + } + + public Builder scenarioName(String scenarioName) { + this.scenarioName = Optional.ofNullable(scenarioName); + return this; + } + + @JsonSetter(value = "triggerHookId", nulls = Nulls.SKIP) + public Builder triggerHookId(Optional triggerHookId) { + this.triggerHookId = triggerHookId; + return this; + } + + public Builder triggerHookId(Double triggerHookId) { + this.triggerHookId = Optional.ofNullable(triggerHookId); + return this; + } + + @JsonSetter(value = "triggerHookName", nulls = Nulls.SKIP) + public Builder triggerHookName(Optional triggerHookName) { + this.triggerHookName = triggerHookName; + return this; + } + + public Builder triggerHookName(String triggerHookName) { + this.triggerHookName = Optional.ofNullable(triggerHookName); + return this; + } + + public MakeToolProviderDetails build() { + return new MakeToolProviderDetails( + templateUrl, + setupInstructions, + scenarioId, + scenarioName, + triggerHookId, + triggerHookName, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/MakeToolWithToolCall.java b/src/main/java/com/vapi/api/types/MakeToolWithToolCall.java new file mode 100644 index 0000000..a63d927 --- /dev/null +++ b/src/main/java/com/vapi/api/types/MakeToolWithToolCall.java @@ -0,0 +1,296 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MakeToolWithToolCall.Builder.class) +public final class MakeToolWithToolCall { + private final Optional async; + + private final Optional> messages; + + private final ToolCall toolCall; + + private final MakeToolMetadata metadata; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private MakeToolWithToolCall( + Optional async, + Optional> messages, + ToolCall toolCall, + MakeToolMetadata metadata, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.toolCall = toolCall; + this.metadata = metadata; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + @JsonProperty("toolCall") + public ToolCall getToolCall() { + return toolCall; + } + + @JsonProperty("metadata") + public MakeToolMetadata getMetadata() { + return metadata; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeToolWithToolCall && equalTo((MakeToolWithToolCall) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MakeToolWithToolCall other) { + return async.equals(other.async) + && messages.equals(other.messages) + && toolCall.equals(other.toolCall) + && metadata.equals(other.metadata) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.async, this.messages, this.toolCall, this.metadata, this.function, this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ToolCallStage builder() { + return new Builder(); + } + + public interface ToolCallStage { + MetadataStage toolCall(@NotNull ToolCall toolCall); + + Builder from(MakeToolWithToolCall other); + } + + public interface MetadataStage { + _FinalStage metadata(@NotNull MakeToolMetadata metadata); + } + + public interface _FinalStage { + MakeToolWithToolCall build(); + + _FinalStage async(Optional async); + + _FinalStage async(Boolean async); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage function(Optional function); + + _FinalStage function(OpenAiFunction function); + + _FinalStage server(Optional server); + + _FinalStage server(Server server); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ToolCallStage, MetadataStage, _FinalStage { + private ToolCall toolCall; + + private MakeToolMetadata metadata; + + private Optional server = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional async = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(MakeToolWithToolCall other) { + async(other.getAsync()); + messages(other.getMessages()); + toolCall(other.getToolCall()); + metadata(other.getMetadata()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + @java.lang.Override + @JsonSetter("toolCall") + public MetadataStage toolCall(@NotNull ToolCall toolCall) { + this.toolCall = Objects.requireNonNull(toolCall, "toolCall must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("metadata") + public _FinalStage metadata(@NotNull MakeToolMetadata metadata) { + this.metadata = Objects.requireNonNull(metadata, "metadata must not be null"); + return this; + } + + /** + *

This is the server that will be hit when this tool is requested by the model.

+ *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + @java.lang.Override + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public _FinalStage server(Optional server) { + this.server = server; + return this; + } + + /** + *

This is the function definition of the tool.

+ *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @java.lang.Override + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public _FinalStage function(Optional function) { + this.function = function; + return this; + } + + /** + *

These are the messages that will be spoken to the user as the tool is running.

+ *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + /** + *

This determines if the tool is async.

+ *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @java.lang.Override + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public _FinalStage async(Optional async) { + this.async = async; + return this; + } + + @java.lang.Override + public MakeToolWithToolCall build() { + return new MakeToolWithToolCall( + async, messages, toolCall, metadata, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/MakeToolWithToolCallMessagesItem.java b/src/main/java/com/vapi/api/types/MakeToolWithToolCallMessagesItem.java new file mode 100644 index 0000000..9662ec8 --- /dev/null +++ b/src/main/java/com/vapi/api/types/MakeToolWithToolCallMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class MakeToolWithToolCallMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private MakeToolWithToolCallMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static MakeToolWithToolCallMessagesItem requestStart(ToolMessageStart value) { + return new MakeToolWithToolCallMessagesItem(new RequestStartValue(value)); + } + + public static MakeToolWithToolCallMessagesItem requestComplete(ToolMessageComplete value) { + return new MakeToolWithToolCallMessagesItem(new RequestCompleteValue(value)); + } + + public static MakeToolWithToolCallMessagesItem requestFailed(ToolMessageFailed value) { + return new MakeToolWithToolCallMessagesItem(new RequestFailedValue(value)); + } + + public static MakeToolWithToolCallMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new MakeToolWithToolCallMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "MakeToolWithToolCallMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "MakeToolWithToolCallMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "MakeToolWithToolCallMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "MakeToolWithToolCallMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "MakeToolWithToolCallMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/MessagePlan.java b/src/main/java/com/vapi/api/types/MessagePlan.java new file mode 100644 index 0000000..970c3a9 --- /dev/null +++ b/src/main/java/com/vapi/api/types/MessagePlan.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MessagePlan.Builder.class) +public final class MessagePlan { + private final Optional> idleMessages; + + private final Optional idleMessageMaxSpokenCount; + + private final Optional idleTimeoutSeconds; + + private final Map additionalProperties; + + private MessagePlan( + Optional> idleMessages, + Optional idleMessageMaxSpokenCount, + Optional idleTimeoutSeconds, + Map additionalProperties) { + this.idleMessages = idleMessages; + this.idleMessageMaxSpokenCount = idleMessageMaxSpokenCount; + this.idleTimeoutSeconds = idleTimeoutSeconds; + this.additionalProperties = additionalProperties; + } + + /** + * @return This are the messages that the assistant will speak when the user hasn't responded for idleTimeoutSeconds. Each time the timeout is triggered, a random message will be chosen from this array. + *

Usage:

+ *
    + *
  • If user gets distracted and doesn't respond for a while, this can be used to grab their attention.
  • + *
  • If the transcriber doesn't pick up what the user said, this can be used to ask the user to repeat themselves. (From the perspective of the assistant, the conversation is idle since it didn't "hear" any user messages.)
  • + *
+ *

@default null (no idle message is spoken)

+ */ + @JsonProperty("idleMessages") + public Optional> getIdleMessages() { + return idleMessages; + } + + /** + * @return This determines the maximum number of times idleMessages can be spoken during the call. + *

@default 3

+ */ + @JsonProperty("idleMessageMaxSpokenCount") + public Optional getIdleMessageMaxSpokenCount() { + return idleMessageMaxSpokenCount; + } + + /** + * @return This is the timeout in seconds before a message from idleMessages is spoken. The clock starts when the assistant finishes speaking and remains active until the user speaks. + *

@default 10

+ */ + @JsonProperty("idleTimeoutSeconds") + public Optional getIdleTimeoutSeconds() { + return idleTimeoutSeconds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MessagePlan && equalTo((MessagePlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MessagePlan other) { + return idleMessages.equals(other.idleMessages) + && idleMessageMaxSpokenCount.equals(other.idleMessageMaxSpokenCount) + && idleTimeoutSeconds.equals(other.idleTimeoutSeconds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.idleMessages, this.idleMessageMaxSpokenCount, this.idleTimeoutSeconds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> idleMessages = Optional.empty(); + + private Optional idleMessageMaxSpokenCount = Optional.empty(); + + private Optional idleTimeoutSeconds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MessagePlan other) { + idleMessages(other.getIdleMessages()); + idleMessageMaxSpokenCount(other.getIdleMessageMaxSpokenCount()); + idleTimeoutSeconds(other.getIdleTimeoutSeconds()); + return this; + } + + @JsonSetter(value = "idleMessages", nulls = Nulls.SKIP) + public Builder idleMessages(Optional> idleMessages) { + this.idleMessages = idleMessages; + return this; + } + + public Builder idleMessages(List idleMessages) { + this.idleMessages = Optional.ofNullable(idleMessages); + return this; + } + + @JsonSetter(value = "idleMessageMaxSpokenCount", nulls = Nulls.SKIP) + public Builder idleMessageMaxSpokenCount(Optional idleMessageMaxSpokenCount) { + this.idleMessageMaxSpokenCount = idleMessageMaxSpokenCount; + return this; + } + + public Builder idleMessageMaxSpokenCount(Double idleMessageMaxSpokenCount) { + this.idleMessageMaxSpokenCount = Optional.ofNullable(idleMessageMaxSpokenCount); + return this; + } + + @JsonSetter(value = "idleTimeoutSeconds", nulls = Nulls.SKIP) + public Builder idleTimeoutSeconds(Optional idleTimeoutSeconds) { + this.idleTimeoutSeconds = idleTimeoutSeconds; + return this; + } + + public Builder idleTimeoutSeconds(Double idleTimeoutSeconds) { + this.idleTimeoutSeconds = Optional.ofNullable(idleTimeoutSeconds); + return this; + } + + public MessagePlan build() { + return new MessagePlan(idleMessages, idleMessageMaxSpokenCount, idleTimeoutSeconds, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/Metrics.java b/src/main/java/com/vapi/api/types/Metrics.java new file mode 100644 index 0000000..42bd6b0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/Metrics.java @@ -0,0 +1,519 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Metrics.Builder.class) +public final class Metrics { + private final String orgId; + + private final String rangeStart; + + private final String rangeEnd; + + private final double bill; + + private final boolean billWithinBillingLimit; + + private final Map billDailyBreakdown; + + private final double callActive; + + private final boolean callActiveWithinConcurrencyLimit; + + private final double callMinutes; + + private final Map callMinutesDailyBreakdown; + + private final double callMinutesAverage; + + private final Map callMinutesAverageDailyBreakdown; + + private final double callCount; + + private final Map callCountDailyBreakdown; + + private final Map additionalProperties; + + private Metrics( + String orgId, + String rangeStart, + String rangeEnd, + double bill, + boolean billWithinBillingLimit, + Map billDailyBreakdown, + double callActive, + boolean callActiveWithinConcurrencyLimit, + double callMinutes, + Map callMinutesDailyBreakdown, + double callMinutesAverage, + Map callMinutesAverageDailyBreakdown, + double callCount, + Map callCountDailyBreakdown, + Map additionalProperties) { + this.orgId = orgId; + this.rangeStart = rangeStart; + this.rangeEnd = rangeEnd; + this.bill = bill; + this.billWithinBillingLimit = billWithinBillingLimit; + this.billDailyBreakdown = billDailyBreakdown; + this.callActive = callActive; + this.callActiveWithinConcurrencyLimit = callActiveWithinConcurrencyLimit; + this.callMinutes = callMinutes; + this.callMinutesDailyBreakdown = callMinutesDailyBreakdown; + this.callMinutesAverage = callMinutesAverage; + this.callMinutesAverageDailyBreakdown = callMinutesAverageDailyBreakdown; + this.callCount = callCount; + this.callCountDailyBreakdown = callCountDailyBreakdown; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + @JsonProperty("rangeStart") + public String getRangeStart() { + return rangeStart; + } + + @JsonProperty("rangeEnd") + public String getRangeEnd() { + return rangeEnd; + } + + @JsonProperty("bill") + public double getBill() { + return bill; + } + + @JsonProperty("billWithinBillingLimit") + public boolean getBillWithinBillingLimit() { + return billWithinBillingLimit; + } + + @JsonProperty("billDailyBreakdown") + public Map getBillDailyBreakdown() { + return billDailyBreakdown; + } + + @JsonProperty("callActive") + public double getCallActive() { + return callActive; + } + + @JsonProperty("callActiveWithinConcurrencyLimit") + public boolean getCallActiveWithinConcurrencyLimit() { + return callActiveWithinConcurrencyLimit; + } + + @JsonProperty("callMinutes") + public double getCallMinutes() { + return callMinutes; + } + + @JsonProperty("callMinutesDailyBreakdown") + public Map getCallMinutesDailyBreakdown() { + return callMinutesDailyBreakdown; + } + + @JsonProperty("callMinutesAverage") + public double getCallMinutesAverage() { + return callMinutesAverage; + } + + @JsonProperty("callMinutesAverageDailyBreakdown") + public Map getCallMinutesAverageDailyBreakdown() { + return callMinutesAverageDailyBreakdown; + } + + @JsonProperty("callCount") + public double getCallCount() { + return callCount; + } + + @JsonProperty("callCountDailyBreakdown") + public Map getCallCountDailyBreakdown() { + return callCountDailyBreakdown; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Metrics && equalTo((Metrics) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Metrics other) { + return orgId.equals(other.orgId) + && rangeStart.equals(other.rangeStart) + && rangeEnd.equals(other.rangeEnd) + && bill == other.bill + && billWithinBillingLimit == other.billWithinBillingLimit + && billDailyBreakdown.equals(other.billDailyBreakdown) + && callActive == other.callActive + && callActiveWithinConcurrencyLimit == other.callActiveWithinConcurrencyLimit + && callMinutes == other.callMinutes + && callMinutesDailyBreakdown.equals(other.callMinutesDailyBreakdown) + && callMinutesAverage == other.callMinutesAverage + && callMinutesAverageDailyBreakdown.equals(other.callMinutesAverageDailyBreakdown) + && callCount == other.callCount + && callCountDailyBreakdown.equals(other.callCountDailyBreakdown); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.orgId, + this.rangeStart, + this.rangeEnd, + this.bill, + this.billWithinBillingLimit, + this.billDailyBreakdown, + this.callActive, + this.callActiveWithinConcurrencyLimit, + this.callMinutes, + this.callMinutesDailyBreakdown, + this.callMinutesAverage, + this.callMinutesAverageDailyBreakdown, + this.callCount, + this.callCountDailyBreakdown); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static OrgIdStage builder() { + return new Builder(); + } + + public interface OrgIdStage { + RangeStartStage orgId(@NotNull String orgId); + + Builder from(Metrics other); + } + + public interface RangeStartStage { + RangeEndStage rangeStart(@NotNull String rangeStart); + } + + public interface RangeEndStage { + BillStage rangeEnd(@NotNull String rangeEnd); + } + + public interface BillStage { + BillWithinBillingLimitStage bill(double bill); + } + + public interface BillWithinBillingLimitStage { + CallActiveStage billWithinBillingLimit(boolean billWithinBillingLimit); + } + + public interface CallActiveStage { + CallActiveWithinConcurrencyLimitStage callActive(double callActive); + } + + public interface CallActiveWithinConcurrencyLimitStage { + CallMinutesStage callActiveWithinConcurrencyLimit(boolean callActiveWithinConcurrencyLimit); + } + + public interface CallMinutesStage { + CallMinutesAverageStage callMinutes(double callMinutes); + } + + public interface CallMinutesAverageStage { + CallCountStage callMinutesAverage(double callMinutesAverage); + } + + public interface CallCountStage { + _FinalStage callCount(double callCount); + } + + public interface _FinalStage { + Metrics build(); + + _FinalStage billDailyBreakdown(Map billDailyBreakdown); + + _FinalStage putAllBillDailyBreakdown(Map billDailyBreakdown); + + _FinalStage billDailyBreakdown(String key, Object value); + + _FinalStage callMinutesDailyBreakdown(Map callMinutesDailyBreakdown); + + _FinalStage putAllCallMinutesDailyBreakdown(Map callMinutesDailyBreakdown); + + _FinalStage callMinutesDailyBreakdown(String key, Object value); + + _FinalStage callMinutesAverageDailyBreakdown(Map callMinutesAverageDailyBreakdown); + + _FinalStage putAllCallMinutesAverageDailyBreakdown(Map callMinutesAverageDailyBreakdown); + + _FinalStage callMinutesAverageDailyBreakdown(String key, Object value); + + _FinalStage callCountDailyBreakdown(Map callCountDailyBreakdown); + + _FinalStage putAllCallCountDailyBreakdown(Map callCountDailyBreakdown); + + _FinalStage callCountDailyBreakdown(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements OrgIdStage, + RangeStartStage, + RangeEndStage, + BillStage, + BillWithinBillingLimitStage, + CallActiveStage, + CallActiveWithinConcurrencyLimitStage, + CallMinutesStage, + CallMinutesAverageStage, + CallCountStage, + _FinalStage { + private String orgId; + + private String rangeStart; + + private String rangeEnd; + + private double bill; + + private boolean billWithinBillingLimit; + + private double callActive; + + private boolean callActiveWithinConcurrencyLimit; + + private double callMinutes; + + private double callMinutesAverage; + + private double callCount; + + private Map callCountDailyBreakdown = new LinkedHashMap<>(); + + private Map callMinutesAverageDailyBreakdown = new LinkedHashMap<>(); + + private Map callMinutesDailyBreakdown = new LinkedHashMap<>(); + + private Map billDailyBreakdown = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Metrics other) { + orgId(other.getOrgId()); + rangeStart(other.getRangeStart()); + rangeEnd(other.getRangeEnd()); + bill(other.getBill()); + billWithinBillingLimit(other.getBillWithinBillingLimit()); + billDailyBreakdown(other.getBillDailyBreakdown()); + callActive(other.getCallActive()); + callActiveWithinConcurrencyLimit(other.getCallActiveWithinConcurrencyLimit()); + callMinutes(other.getCallMinutes()); + callMinutesDailyBreakdown(other.getCallMinutesDailyBreakdown()); + callMinutesAverage(other.getCallMinutesAverage()); + callMinutesAverageDailyBreakdown(other.getCallMinutesAverageDailyBreakdown()); + callCount(other.getCallCount()); + callCountDailyBreakdown(other.getCallCountDailyBreakdown()); + return this; + } + + @java.lang.Override + @JsonSetter("orgId") + public RangeStartStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("rangeStart") + public RangeEndStage rangeStart(@NotNull String rangeStart) { + this.rangeStart = Objects.requireNonNull(rangeStart, "rangeStart must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("rangeEnd") + public BillStage rangeEnd(@NotNull String rangeEnd) { + this.rangeEnd = Objects.requireNonNull(rangeEnd, "rangeEnd must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("bill") + public BillWithinBillingLimitStage bill(double bill) { + this.bill = bill; + return this; + } + + @java.lang.Override + @JsonSetter("billWithinBillingLimit") + public CallActiveStage billWithinBillingLimit(boolean billWithinBillingLimit) { + this.billWithinBillingLimit = billWithinBillingLimit; + return this; + } + + @java.lang.Override + @JsonSetter("callActive") + public CallActiveWithinConcurrencyLimitStage callActive(double callActive) { + this.callActive = callActive; + return this; + } + + @java.lang.Override + @JsonSetter("callActiveWithinConcurrencyLimit") + public CallMinutesStage callActiveWithinConcurrencyLimit(boolean callActiveWithinConcurrencyLimit) { + this.callActiveWithinConcurrencyLimit = callActiveWithinConcurrencyLimit; + return this; + } + + @java.lang.Override + @JsonSetter("callMinutes") + public CallMinutesAverageStage callMinutes(double callMinutes) { + this.callMinutes = callMinutes; + return this; + } + + @java.lang.Override + @JsonSetter("callMinutesAverage") + public CallCountStage callMinutesAverage(double callMinutesAverage) { + this.callMinutesAverage = callMinutesAverage; + return this; + } + + @java.lang.Override + @JsonSetter("callCount") + public _FinalStage callCount(double callCount) { + this.callCount = callCount; + return this; + } + + @java.lang.Override + public _FinalStage callCountDailyBreakdown(String key, Object value) { + this.callCountDailyBreakdown.put(key, value); + return this; + } + + @java.lang.Override + public _FinalStage putAllCallCountDailyBreakdown(Map callCountDailyBreakdown) { + this.callCountDailyBreakdown.putAll(callCountDailyBreakdown); + return this; + } + + @java.lang.Override + @JsonSetter(value = "callCountDailyBreakdown", nulls = Nulls.SKIP) + public _FinalStage callCountDailyBreakdown(Map callCountDailyBreakdown) { + this.callCountDailyBreakdown.clear(); + this.callCountDailyBreakdown.putAll(callCountDailyBreakdown); + return this; + } + + @java.lang.Override + public _FinalStage callMinutesAverageDailyBreakdown(String key, Object value) { + this.callMinutesAverageDailyBreakdown.put(key, value); + return this; + } + + @java.lang.Override + public _FinalStage putAllCallMinutesAverageDailyBreakdown( + Map callMinutesAverageDailyBreakdown) { + this.callMinutesAverageDailyBreakdown.putAll(callMinutesAverageDailyBreakdown); + return this; + } + + @java.lang.Override + @JsonSetter(value = "callMinutesAverageDailyBreakdown", nulls = Nulls.SKIP) + public _FinalStage callMinutesAverageDailyBreakdown(Map callMinutesAverageDailyBreakdown) { + this.callMinutesAverageDailyBreakdown.clear(); + this.callMinutesAverageDailyBreakdown.putAll(callMinutesAverageDailyBreakdown); + return this; + } + + @java.lang.Override + public _FinalStage callMinutesDailyBreakdown(String key, Object value) { + this.callMinutesDailyBreakdown.put(key, value); + return this; + } + + @java.lang.Override + public _FinalStage putAllCallMinutesDailyBreakdown(Map callMinutesDailyBreakdown) { + this.callMinutesDailyBreakdown.putAll(callMinutesDailyBreakdown); + return this; + } + + @java.lang.Override + @JsonSetter(value = "callMinutesDailyBreakdown", nulls = Nulls.SKIP) + public _FinalStage callMinutesDailyBreakdown(Map callMinutesDailyBreakdown) { + this.callMinutesDailyBreakdown.clear(); + this.callMinutesDailyBreakdown.putAll(callMinutesDailyBreakdown); + return this; + } + + @java.lang.Override + public _FinalStage billDailyBreakdown(String key, Object value) { + this.billDailyBreakdown.put(key, value); + return this; + } + + @java.lang.Override + public _FinalStage putAllBillDailyBreakdown(Map billDailyBreakdown) { + this.billDailyBreakdown.putAll(billDailyBreakdown); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billDailyBreakdown", nulls = Nulls.SKIP) + public _FinalStage billDailyBreakdown(Map billDailyBreakdown) { + this.billDailyBreakdown.clear(); + this.billDailyBreakdown.putAll(billDailyBreakdown); + return this; + } + + @java.lang.Override + public Metrics build() { + return new Metrics( + orgId, + rangeStart, + rangeEnd, + bill, + billWithinBillingLimit, + billDailyBreakdown, + callActive, + callActiveWithinConcurrencyLimit, + callMinutes, + callMinutesDailyBreakdown, + callMinutesAverage, + callMinutesAverageDailyBreakdown, + callCount, + callCountDailyBreakdown, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ModelBasedCondition.java b/src/main/java/com/vapi/api/types/ModelBasedCondition.java new file mode 100644 index 0000000..a68df26 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ModelBasedCondition.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ModelBasedCondition.Builder.class) +public final class ModelBasedCondition { + private final String instruction; + + private final Map additionalProperties; + + private ModelBasedCondition(String instruction, Map additionalProperties) { + this.instruction = instruction; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the instruction which should output a boolean value when passed to a model. + *

You can reference any variable in the context of the current block execution (step):

+ *
    + *
  • "{{output.your-property-name}}" for current step's output
  • + *
  • "{{input.your-property-name}}" for current step's input
  • + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • + *
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

You can also talk about the current step's output or input directly:

+ *
    + *
  • "{{output.your-property-name}} is greater than 10"
  • + *
  • "{{input.your-property-name}} is greater than 10"
  • + *
+ *

Examples:

+ *
    + *
  • "{{input.age}} is greater than 10"
  • + *
  • "{{input.age}} is greater than {{input.age2}}"
  • + *
  • "{{output.age}} is greater than 10"
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ */ + @JsonProperty("instruction") + public String getInstruction() { + return instruction; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ModelBasedCondition && equalTo((ModelBasedCondition) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ModelBasedCondition other) { + return instruction.equals(other.instruction); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.instruction); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static InstructionStage builder() { + return new Builder(); + } + + public interface InstructionStage { + _FinalStage instruction(@NotNull String instruction); + + Builder from(ModelBasedCondition other); + } + + public interface _FinalStage { + ModelBasedCondition build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements InstructionStage, _FinalStage { + private String instruction; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ModelBasedCondition other) { + instruction(other.getInstruction()); + return this; + } + + /** + *

This is the instruction which should output a boolean value when passed to a model.

+ *

You can reference any variable in the context of the current block execution (step):

+ *
    + *
  • "{{output.your-property-name}}" for current step's output
  • + *
  • "{{input.your-property-name}}" for current step's input
  • + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • + *
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

You can also talk about the current step's output or input directly:

+ *
    + *
  • "{{output.your-property-name}} is greater than 10"
  • + *
  • "{{input.your-property-name}} is greater than 10"
  • + *
+ *

Examples:

+ *
    + *
  • "{{input.age}} is greater than 10"
  • + *
  • "{{input.age}} is greater than {{input.age2}}"
  • + *
  • "{{output.age}} is greater than 10"
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("instruction") + public _FinalStage instruction(@NotNull String instruction) { + this.instruction = Objects.requireNonNull(instruction, "instruction must not be null"); + return this; + } + + @java.lang.Override + public ModelBasedCondition build() { + return new ModelBasedCondition(instruction, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ModelCost.java b/src/main/java/com/vapi/api/types/ModelCost.java new file mode 100644 index 0000000..23522bf --- /dev/null +++ b/src/main/java/com/vapi/api/types/ModelCost.java @@ -0,0 +1,251 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ModelCost.Builder.class) +public final class ModelCost { + private final Map model; + + private final double promptTokens; + + private final double completionTokens; + + private final double cost; + + private final Map additionalProperties; + + private ModelCost( + Map model, + double promptTokens, + double completionTokens, + double cost, + Map additionalProperties) { + this.model = model; + this.promptTokens = promptTokens; + this.completionTokens = completionTokens; + this.cost = cost; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the model that was used during the call. + *

This matches one of the following:

+ *
    + *
  • call.assistant.model,
  • + *
  • call.assistantId->model,
  • + *
  • call.squad[n].assistant.model,
  • + *
  • call.squad[n].assistantId->model,
  • + *
  • call.squadId->[n].assistant.model,
  • + *
  • call.squadId->[n].assistantId->model.
  • + *
+ */ + @JsonProperty("model") + public Map getModel() { + return model; + } + + /** + * @return This is the number of prompt tokens used in the call. These should be total prompt tokens used in the call for single assistant calls, while squad calls will have multiple model costs one for each assistant that was used. + */ + @JsonProperty("promptTokens") + public double getPromptTokens() { + return promptTokens; + } + + /** + * @return This is the number of completion tokens generated in the call. These should be total completion tokens used in the call for single assistant calls, while squad calls will have multiple model costs one for each assistant that was used. + */ + @JsonProperty("completionTokens") + public double getCompletionTokens() { + return completionTokens; + } + + /** + * @return This is the cost of the component in USD. + */ + @JsonProperty("cost") + public double getCost() { + return cost; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ModelCost && equalTo((ModelCost) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ModelCost other) { + return model.equals(other.model) + && promptTokens == other.promptTokens + && completionTokens == other.completionTokens + && cost == other.cost; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.model, this.promptTokens, this.completionTokens, this.cost); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PromptTokensStage builder() { + return new Builder(); + } + + public interface PromptTokensStage { + CompletionTokensStage promptTokens(double promptTokens); + + Builder from(ModelCost other); + } + + public interface CompletionTokensStage { + CostStage completionTokens(double completionTokens); + } + + public interface CostStage { + _FinalStage cost(double cost); + } + + public interface _FinalStage { + ModelCost build(); + + _FinalStage model(Map model); + + _FinalStage putAllModel(Map model); + + _FinalStage model(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PromptTokensStage, CompletionTokensStage, CostStage, _FinalStage { + private double promptTokens; + + private double completionTokens; + + private double cost; + + private Map model = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ModelCost other) { + model(other.getModel()); + promptTokens(other.getPromptTokens()); + completionTokens(other.getCompletionTokens()); + cost(other.getCost()); + return this; + } + + /** + *

This is the number of prompt tokens used in the call. These should be total prompt tokens used in the call for single assistant calls, while squad calls will have multiple model costs one for each assistant that was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("promptTokens") + public CompletionTokensStage promptTokens(double promptTokens) { + this.promptTokens = promptTokens; + return this; + } + + /** + *

This is the number of completion tokens generated in the call. These should be total completion tokens used in the call for single assistant calls, while squad calls will have multiple model costs one for each assistant that was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("completionTokens") + public CostStage completionTokens(double completionTokens) { + this.completionTokens = completionTokens; + return this; + } + + /** + *

This is the cost of the component in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cost") + public _FinalStage cost(double cost) { + this.cost = cost; + return this; + } + + /** + *

This is the model that was used during the call.

+ *

This matches one of the following:

+ *
    + *
  • call.assistant.model,
  • + *
  • call.assistantId->model,
  • + *
  • call.squad[n].assistant.model,
  • + *
  • call.squad[n].assistantId->model,
  • + *
  • call.squadId->[n].assistant.model,
  • + *
  • call.squadId->[n].assistantId->model.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage model(String key, Object value) { + this.model.put(key, value); + return this; + } + + /** + *

This is the model that was used during the call.

+ *

This matches one of the following:

+ *
    + *
  • call.assistant.model,
  • + *
  • call.assistantId->model,
  • + *
  • call.squad[n].assistant.model,
  • + *
  • call.squad[n].assistantId->model,
  • + *
  • call.squadId->[n].assistant.model,
  • + *
  • call.squadId->[n].assistantId->model.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllModel(Map model) { + this.model.putAll(model); + return this; + } + + @java.lang.Override + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public _FinalStage model(Map model) { + this.model.clear(); + this.model.putAll(model); + return this; + } + + @java.lang.Override + public ModelCost build() { + return new ModelCost(model, promptTokens, completionTokens, cost, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/Monitor.java b/src/main/java/com/vapi/api/types/Monitor.java new file mode 100644 index 0000000..9607bb4 --- /dev/null +++ b/src/main/java/com/vapi/api/types/Monitor.java @@ -0,0 +1,123 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Monitor.Builder.class) +public final class Monitor { + private final Optional listenUrl; + + private final Optional controlUrl; + + private final Map additionalProperties; + + private Monitor(Optional listenUrl, Optional controlUrl, Map additionalProperties) { + this.listenUrl = listenUrl; + this.controlUrl = controlUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the URL where the assistant's calls can be listened to in real-time. To enable, set assistant.monitorPlan.listenEnabled to true. + */ + @JsonProperty("listenUrl") + public Optional getListenUrl() { + return listenUrl; + } + + /** + * @return This is the URL where the assistant's calls can be controlled in real-time. To enable, set assistant.monitorPlan.controlEnabled to true. + */ + @JsonProperty("controlUrl") + public Optional getControlUrl() { + return controlUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Monitor && equalTo((Monitor) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Monitor other) { + return listenUrl.equals(other.listenUrl) && controlUrl.equals(other.controlUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.listenUrl, this.controlUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional listenUrl = Optional.empty(); + + private Optional controlUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(Monitor other) { + listenUrl(other.getListenUrl()); + controlUrl(other.getControlUrl()); + return this; + } + + @JsonSetter(value = "listenUrl", nulls = Nulls.SKIP) + public Builder listenUrl(Optional listenUrl) { + this.listenUrl = listenUrl; + return this; + } + + public Builder listenUrl(String listenUrl) { + this.listenUrl = Optional.ofNullable(listenUrl); + return this; + } + + @JsonSetter(value = "controlUrl", nulls = Nulls.SKIP) + public Builder controlUrl(Optional controlUrl) { + this.controlUrl = controlUrl; + return this; + } + + public Builder controlUrl(String controlUrl) { + this.controlUrl = Optional.ofNullable(controlUrl); + return this; + } + + public Monitor build() { + return new Monitor(listenUrl, controlUrl, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/MonitorPlan.java b/src/main/java/com/vapi/api/types/MonitorPlan.java new file mode 100644 index 0000000..40bc551 --- /dev/null +++ b/src/main/java/com/vapi/api/types/MonitorPlan.java @@ -0,0 +1,131 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = MonitorPlan.Builder.class) +public final class MonitorPlan { + private final Optional listenEnabled; + + private final Optional controlEnabled; + + private final Map additionalProperties; + + private MonitorPlan( + Optional listenEnabled, + Optional controlEnabled, + Map additionalProperties) { + this.listenEnabled = listenEnabled; + this.controlEnabled = controlEnabled; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines whether the assistant's calls allow live listening. Defaults to true. + *

Fetch call.monitor.listenUrl to get the live listening URL.

+ *

@default true

+ */ + @JsonProperty("listenEnabled") + public Optional getListenEnabled() { + return listenEnabled; + } + + /** + * @return This determines whether the assistant's calls allow live control. Defaults to true. + *

Fetch call.monitor.controlUrl to get the live control URL.

+ *

To use, send any control message via a POST request to call.monitor.controlUrl. Here are the types of controls supported: https://docs.vapi.ai/api-reference/messages/client-inbound-message

+ *

@default true

+ */ + @JsonProperty("controlEnabled") + public Optional getControlEnabled() { + return controlEnabled; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MonitorPlan && equalTo((MonitorPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(MonitorPlan other) { + return listenEnabled.equals(other.listenEnabled) && controlEnabled.equals(other.controlEnabled); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.listenEnabled, this.controlEnabled); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional listenEnabled = Optional.empty(); + + private Optional controlEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(MonitorPlan other) { + listenEnabled(other.getListenEnabled()); + controlEnabled(other.getControlEnabled()); + return this; + } + + @JsonSetter(value = "listenEnabled", nulls = Nulls.SKIP) + public Builder listenEnabled(Optional listenEnabled) { + this.listenEnabled = listenEnabled; + return this; + } + + public Builder listenEnabled(Boolean listenEnabled) { + this.listenEnabled = Optional.ofNullable(listenEnabled); + return this; + } + + @JsonSetter(value = "controlEnabled", nulls = Nulls.SKIP) + public Builder controlEnabled(Optional controlEnabled) { + this.controlEnabled = controlEnabled; + return this; + } + + public Builder controlEnabled(Boolean controlEnabled) { + this.controlEnabled = Optional.ofNullable(controlEnabled); + return this; + } + + public MonitorPlan build() { + return new MonitorPlan(listenEnabled, controlEnabled, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/NeetsVoice.java b/src/main/java/com/vapi/api/types/NeetsVoice.java new file mode 100644 index 0000000..f88f3ae --- /dev/null +++ b/src/main/java/com/vapi/api/types/NeetsVoice.java @@ -0,0 +1,189 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = NeetsVoice.Builder.class) +public final class NeetsVoice { + private final Optional fillerInjectionEnabled; + + private final NeetsVoiceId voiceId; + + private final Optional chunkPlan; + + private final Map additionalProperties; + + private NeetsVoice( + Optional fillerInjectionEnabled, + NeetsVoiceId voiceId, + Optional chunkPlan, + Map additionalProperties) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + this.voiceId = voiceId; + this.chunkPlan = chunkPlan; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines whether fillers are injected into the model output before inputting it into the voice provider. + *

Default false because you can achieve better results with prompting the model.

+ */ + @JsonProperty("fillerInjectionEnabled") + public Optional getFillerInjectionEnabled() { + return fillerInjectionEnabled; + } + + /** + * @return This is the provider-specific ID that will be used. + */ + @JsonProperty("voiceId") + public NeetsVoiceId getVoiceId() { + return voiceId; + } + + /** + * @return This is the plan for chunking the model output before it is sent to the voice provider. + */ + @JsonProperty("chunkPlan") + public Optional getChunkPlan() { + return chunkPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NeetsVoice && equalTo((NeetsVoice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(NeetsVoice other) { + return fillerInjectionEnabled.equals(other.fillerInjectionEnabled) + && voiceId.equals(other.voiceId) + && chunkPlan.equals(other.chunkPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fillerInjectionEnabled, this.voiceId, this.chunkPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VoiceIdStage builder() { + return new Builder(); + } + + public interface VoiceIdStage { + _FinalStage voiceId(@NotNull NeetsVoiceId voiceId); + + Builder from(NeetsVoice other); + } + + public interface _FinalStage { + NeetsVoice build(); + + _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled); + + _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled); + + _FinalStage chunkPlan(Optional chunkPlan); + + _FinalStage chunkPlan(ChunkPlan chunkPlan); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VoiceIdStage, _FinalStage { + private NeetsVoiceId voiceId; + + private Optional chunkPlan = Optional.empty(); + + private Optional fillerInjectionEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(NeetsVoice other) { + fillerInjectionEnabled(other.getFillerInjectionEnabled()); + voiceId(other.getVoiceId()); + chunkPlan(other.getChunkPlan()); + return this; + } + + /** + *

This is the provider-specific ID that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("voiceId") + public _FinalStage voiceId(@NotNull NeetsVoiceId voiceId) { + this.voiceId = Objects.requireNonNull(voiceId, "voiceId must not be null"); + return this; + } + + /** + *

This is the plan for chunking the model output before it is sent to the voice provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage chunkPlan(ChunkPlan chunkPlan) { + this.chunkPlan = Optional.ofNullable(chunkPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "chunkPlan", nulls = Nulls.SKIP) + public _FinalStage chunkPlan(Optional chunkPlan) { + this.chunkPlan = chunkPlan; + return this; + } + + /** + *

This determines whether fillers are injected into the model output before inputting it into the voice provider.

+ *

Default false because you can achieve better results with prompting the model.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled) { + this.fillerInjectionEnabled = Optional.ofNullable(fillerInjectionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fillerInjectionEnabled", nulls = Nulls.SKIP) + public _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + return this; + } + + @java.lang.Override + public NeetsVoice build() { + return new NeetsVoice(fillerInjectionEnabled, voiceId, chunkPlan, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/NeetsVoiceId.java b/src/main/java/com/vapi/api/types/NeetsVoiceId.java new file mode 100644 index 0000000..115a44b --- /dev/null +++ b/src/main/java/com/vapi/api/types/NeetsVoiceId.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.vapi.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = NeetsVoiceId.Deserializer.class) +public final class NeetsVoiceId { + private final Object value; + + private final int type; + + private NeetsVoiceId(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((NeetsVoiceIdEnum) this.value); + } else if (this.type == 1) { + return visitor.visit((String) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NeetsVoiceId && equalTo((NeetsVoiceId) other); + } + + private boolean equalTo(NeetsVoiceId other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static NeetsVoiceId of(NeetsVoiceIdEnum value) { + return new NeetsVoiceId(value, 0); + } + + public static NeetsVoiceId of(String value) { + return new NeetsVoiceId(value, 1); + } + + public interface Visitor { + T visit(NeetsVoiceIdEnum value); + + T visit(String value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(NeetsVoiceId.class); + } + + @java.lang.Override + public NeetsVoiceId deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, NeetsVoiceIdEnum.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (IllegalArgumentException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/vapi/api/types/NeetsVoiceIdEnum.java b/src/main/java/com/vapi/api/types/NeetsVoiceIdEnum.java new file mode 100644 index 0000000..41604cc --- /dev/null +++ b/src/main/java/com/vapi/api/types/NeetsVoiceIdEnum.java @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum NeetsVoiceIdEnum { + VITS("vits"); + + private final String value; + + NeetsVoiceIdEnum(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/OpenAiCredential.java b/src/main/java/com/vapi/api/types/OpenAiCredential.java new file mode 100644 index 0000000..9696539 --- /dev/null +++ b/src/main/java/com/vapi/api/types/OpenAiCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = OpenAiCredential.Builder.class) +public final class OpenAiCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private OpenAiCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "openai"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenAiCredential && equalTo((OpenAiCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OpenAiCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(OpenAiCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + OpenAiCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(OpenAiCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public OpenAiCredential build() { + return new OpenAiCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/OpenAiFunction.java b/src/main/java/com/vapi/api/types/OpenAiFunction.java new file mode 100644 index 0000000..b3d2d21 --- /dev/null +++ b/src/main/java/com/vapi/api/types/OpenAiFunction.java @@ -0,0 +1,184 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = OpenAiFunction.Builder.class) +public final class OpenAiFunction { + private final String name; + + private final Optional description; + + private final Optional parameters; + + private final Map additionalProperties; + + private OpenAiFunction( + String name, + Optional description, + Optional parameters, + Map additionalProperties) { + this.name = name; + this.description = description; + this.parameters = parameters; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the the name of the function to be called. + *

Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.

+ */ + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return These are the parameters the functions accepts, described as a JSON Schema object. + *

See the OpenAI guide for examples, and the JSON Schema reference for documentation about the format.

+ *

Omitting parameters defines a function with an empty parameter list.

+ */ + @JsonProperty("parameters") + public Optional getParameters() { + return parameters; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenAiFunction && equalTo((OpenAiFunction) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OpenAiFunction other) { + return name.equals(other.name) && description.equals(other.description) && parameters.equals(other.parameters); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.description, this.parameters); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + + Builder from(OpenAiFunction other); + } + + public interface _FinalStage { + OpenAiFunction build(); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage parameters(Optional parameters); + + _FinalStage parameters(OpenAiFunctionParameters parameters); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + private Optional parameters = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(OpenAiFunction other) { + name(other.getName()); + description(other.getDescription()); + parameters(other.getParameters()); + return this; + } + + /** + *

This is the the name of the function to be called.

+ *

Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

These are the parameters the functions accepts, described as a JSON Schema object.

+ *

See the OpenAI guide for examples, and the JSON Schema reference for documentation about the format.

+ *

Omitting parameters defines a function with an empty parameter list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage parameters(OpenAiFunctionParameters parameters) { + this.parameters = Optional.ofNullable(parameters); + return this; + } + + @java.lang.Override + @JsonSetter(value = "parameters", nulls = Nulls.SKIP) + public _FinalStage parameters(Optional parameters) { + this.parameters = parameters; + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public OpenAiFunction build() { + return new OpenAiFunction(name, description, parameters, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/OpenAiFunctionParameters.java b/src/main/java/com/vapi/api/types/OpenAiFunctionParameters.java new file mode 100644 index 0000000..d52fdbe --- /dev/null +++ b/src/main/java/com/vapi/api/types/OpenAiFunctionParameters.java @@ -0,0 +1,144 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = OpenAiFunctionParameters.Builder.class) +public final class OpenAiFunctionParameters { + private final Map properties; + + private final Optional> required; + + private final Map additionalProperties; + + private OpenAiFunctionParameters( + Map properties, + Optional> required, + Map additionalProperties) { + this.properties = properties; + this.required = required; + this.additionalProperties = additionalProperties; + } + + /** + * @return This must be set to 'object'. It instructs the model to return a JSON object containing the function call properties. + */ + @JsonProperty("type") + public String getType() { + return "object"; + } + + /** + * @return This provides a description of the properties required by the function. + * JSON Schema can be used to specify expectations for each property. + * Refer to this doc for a comprehensive guide on JSON Schema. + */ + @JsonProperty("properties") + public Map getProperties() { + return properties; + } + + /** + * @return This specifies the properties that are required by the function. + */ + @JsonProperty("required") + public Optional> getRequired() { + return required; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenAiFunctionParameters && equalTo((OpenAiFunctionParameters) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OpenAiFunctionParameters other) { + return properties.equals(other.properties) && required.equals(other.required); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.properties, this.required); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Map properties = new LinkedHashMap<>(); + + private Optional> required = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(OpenAiFunctionParameters other) { + properties(other.getProperties()); + required(other.getRequired()); + return this; + } + + @JsonSetter(value = "properties", nulls = Nulls.SKIP) + public Builder properties(Map properties) { + this.properties.clear(); + this.properties.putAll(properties); + return this; + } + + public Builder putAllProperties(Map properties) { + this.properties.putAll(properties); + return this; + } + + public Builder properties(String key, JsonSchema value) { + this.properties.put(key, value); + return this; + } + + @JsonSetter(value = "required", nulls = Nulls.SKIP) + public Builder required(Optional> required) { + this.required = required; + return this; + } + + public Builder required(List required) { + this.required = Optional.ofNullable(required); + return this; + } + + public OpenAiFunctionParameters build() { + return new OpenAiFunctionParameters(properties, required, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/OpenAiMessage.java b/src/main/java/com/vapi/api/types/OpenAiMessage.java new file mode 100644 index 0000000..5913059 --- /dev/null +++ b/src/main/java/com/vapi/api/types/OpenAiMessage.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = OpenAiMessage.Builder.class) +public final class OpenAiMessage { + private final Optional content; + + private final OpenAiMessageRole role; + + private final Map additionalProperties; + + private OpenAiMessage(Optional content, OpenAiMessageRole role, Map additionalProperties) { + this.content = content; + this.role = role; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("content") + public Optional getContent() { + return content; + } + + @JsonProperty("role") + public OpenAiMessageRole getRole() { + return role; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenAiMessage && equalTo((OpenAiMessage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OpenAiMessage other) { + return content.equals(other.content) && role.equals(other.role); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.content, this.role); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RoleStage builder() { + return new Builder(); + } + + public interface RoleStage { + _FinalStage role(@NotNull OpenAiMessageRole role); + + Builder from(OpenAiMessage other); + } + + public interface _FinalStage { + OpenAiMessage build(); + + _FinalStage content(Optional content); + + _FinalStage content(String content); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RoleStage, _FinalStage { + private OpenAiMessageRole role; + + private Optional content = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(OpenAiMessage other) { + content(other.getContent()); + role(other.getRole()); + return this; + } + + @java.lang.Override + @JsonSetter("role") + public _FinalStage role(@NotNull OpenAiMessageRole role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + @java.lang.Override + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public _FinalStage content(Optional content) { + this.content = content; + return this; + } + + @java.lang.Override + public OpenAiMessage build() { + return new OpenAiMessage(content, role, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/OpenAiMessageRole.java b/src/main/java/com/vapi/api/types/OpenAiMessageRole.java new file mode 100644 index 0000000..0afcf00 --- /dev/null +++ b/src/main/java/com/vapi/api/types/OpenAiMessageRole.java @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum OpenAiMessageRole { + ASSISTANT("assistant"), + + FUNCTION("function"), + + USER("user"), + + SYSTEM("system"), + + TOOL("tool"); + + private final String value; + + OpenAiMessageRole(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/OpenAiModel.java b/src/main/java/com/vapi/api/types/OpenAiModel.java new file mode 100644 index 0000000..a1bd684 --- /dev/null +++ b/src/main/java/com/vapi/api/types/OpenAiModel.java @@ -0,0 +1,512 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = OpenAiModel.Builder.class) +public final class OpenAiModel { + private final Optional> messages; + + private final Optional> tools; + + private final Optional> toolIds; + + private final OpenAiModelModel model; + + private final Optional> fallbackModels; + + private final Optional semanticCachingEnabled; + + private final Optional temperature; + + private final Optional knowledgeBase; + + private final Optional maxTokens; + + private final Optional emotionRecognitionEnabled; + + private final Optional numFastTurns; + + private final Map additionalProperties; + + private OpenAiModel( + Optional> messages, + Optional> tools, + Optional> toolIds, + OpenAiModelModel model, + Optional> fallbackModels, + Optional semanticCachingEnabled, + Optional temperature, + Optional knowledgeBase, + Optional maxTokens, + Optional emotionRecognitionEnabled, + Optional numFastTurns, + Map additionalProperties) { + this.messages = messages; + this.tools = tools; + this.toolIds = toolIds; + this.model = model; + this.fallbackModels = fallbackModels; + this.semanticCachingEnabled = semanticCachingEnabled; + this.temperature = temperature; + this.knowledgeBase = knowledgeBase; + this.maxTokens = maxTokens; + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + this.numFastTurns = numFastTurns; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the starting state for the conversation. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return These are the tools that the assistant can use during the call. To use existing tools, use toolIds. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("tools") + public Optional> getTools() { + return tools; + } + + /** + * @return These are the tools that the assistant can use during the call. To use transient tools, use tools. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("toolIds") + public Optional> getToolIds() { + return toolIds; + } + + /** + * @return This is the OpenAI model that will be used. + */ + @JsonProperty("model") + public OpenAiModelModel getModel() { + return model; + } + + /** + * @return These are the fallback models that will be used if the primary model fails. This shouldn't be specified unless you have a specific reason to do so. Vapi will automatically find the fastest fallbacks that make sense. + */ + @JsonProperty("fallbackModels") + public Optional> getFallbackModels() { + return fallbackModels; + } + + @JsonProperty("semanticCachingEnabled") + public Optional getSemanticCachingEnabled() { + return semanticCachingEnabled; + } + + /** + * @return This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + */ + @JsonProperty("temperature") + public Optional getTemperature() { + return temperature; + } + + /** + * @return These are the options for the knowledge base. + */ + @JsonProperty("knowledgeBase") + public Optional getKnowledgeBase() { + return knowledgeBase; + } + + /** + * @return This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. + */ + @JsonProperty("maxTokens") + public Optional getMaxTokens() { + return maxTokens; + } + + /** + * @return This determines whether we detect user's emotion while they speak and send it as an additional info to model. + *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ */ + @JsonProperty("emotionRecognitionEnabled") + public Optional getEmotionRecognitionEnabled() { + return emotionRecognitionEnabled; + } + + /** + * @return This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai. + *

Default is 0.

+ *

@default 0

+ */ + @JsonProperty("numFastTurns") + public Optional getNumFastTurns() { + return numFastTurns; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenAiModel && equalTo((OpenAiModel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OpenAiModel other) { + return messages.equals(other.messages) + && tools.equals(other.tools) + && toolIds.equals(other.toolIds) + && model.equals(other.model) + && fallbackModels.equals(other.fallbackModels) + && semanticCachingEnabled.equals(other.semanticCachingEnabled) + && temperature.equals(other.temperature) + && knowledgeBase.equals(other.knowledgeBase) + && maxTokens.equals(other.maxTokens) + && emotionRecognitionEnabled.equals(other.emotionRecognitionEnabled) + && numFastTurns.equals(other.numFastTurns); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.messages, + this.tools, + this.toolIds, + this.model, + this.fallbackModels, + this.semanticCachingEnabled, + this.temperature, + this.knowledgeBase, + this.maxTokens, + this.emotionRecognitionEnabled, + this.numFastTurns); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + _FinalStage model(@NotNull OpenAiModelModel model); + + Builder from(OpenAiModel other); + } + + public interface _FinalStage { + OpenAiModel build(); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage tools(Optional> tools); + + _FinalStage tools(List tools); + + _FinalStage toolIds(Optional> toolIds); + + _FinalStage toolIds(List toolIds); + + _FinalStage fallbackModels(Optional> fallbackModels); + + _FinalStage fallbackModels(List fallbackModels); + + _FinalStage semanticCachingEnabled(Optional semanticCachingEnabled); + + _FinalStage semanticCachingEnabled(Boolean semanticCachingEnabled); + + _FinalStage temperature(Optional temperature); + + _FinalStage temperature(Double temperature); + + _FinalStage knowledgeBase(Optional knowledgeBase); + + _FinalStage knowledgeBase(KnowledgeBase knowledgeBase); + + _FinalStage maxTokens(Optional maxTokens); + + _FinalStage maxTokens(Double maxTokens); + + _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled); + + _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled); + + _FinalStage numFastTurns(Optional numFastTurns); + + _FinalStage numFastTurns(Double numFastTurns); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, _FinalStage { + private OpenAiModelModel model; + + private Optional numFastTurns = Optional.empty(); + + private Optional emotionRecognitionEnabled = Optional.empty(); + + private Optional maxTokens = Optional.empty(); + + private Optional knowledgeBase = Optional.empty(); + + private Optional temperature = Optional.empty(); + + private Optional semanticCachingEnabled = Optional.empty(); + + private Optional> fallbackModels = Optional.empty(); + + private Optional> toolIds = Optional.empty(); + + private Optional> tools = Optional.empty(); + + private Optional> messages = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(OpenAiModel other) { + messages(other.getMessages()); + tools(other.getTools()); + toolIds(other.getToolIds()); + model(other.getModel()); + fallbackModels(other.getFallbackModels()); + semanticCachingEnabled(other.getSemanticCachingEnabled()); + temperature(other.getTemperature()); + knowledgeBase(other.getKnowledgeBase()); + maxTokens(other.getMaxTokens()); + emotionRecognitionEnabled(other.getEmotionRecognitionEnabled()); + numFastTurns(other.getNumFastTurns()); + return this; + } + + /** + *

This is the OpenAI model that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("model") + public _FinalStage model(@NotNull OpenAiModelModel model) { + this.model = Objects.requireNonNull(model, "model must not be null"); + return this; + } + + /** + *

This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai.

+ *

Default is 0.

+ *

@default 0

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numFastTurns(Double numFastTurns) { + this.numFastTurns = Optional.ofNullable(numFastTurns); + return this; + } + + @java.lang.Override + @JsonSetter(value = "numFastTurns", nulls = Nulls.SKIP) + public _FinalStage numFastTurns(Optional numFastTurns) { + this.numFastTurns = numFastTurns; + return this; + } + + /** + *

This determines whether we detect user's emotion while they speak and send it as an additional info to model.

+ *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = Optional.ofNullable(emotionRecognitionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "emotionRecognitionEnabled", nulls = Nulls.SKIP) + public _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + return this; + } + + /** + *

This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxTokens(Double maxTokens) { + this.maxTokens = Optional.ofNullable(maxTokens); + return this; + } + + @java.lang.Override + @JsonSetter(value = "maxTokens", nulls = Nulls.SKIP) + public _FinalStage maxTokens(Optional maxTokens) { + this.maxTokens = maxTokens; + return this; + } + + /** + *

These are the options for the knowledge base.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage knowledgeBase(KnowledgeBase knowledgeBase) { + this.knowledgeBase = Optional.ofNullable(knowledgeBase); + return this; + } + + @java.lang.Override + @JsonSetter(value = "knowledgeBase", nulls = Nulls.SKIP) + public _FinalStage knowledgeBase(Optional knowledgeBase) { + this.knowledgeBase = knowledgeBase; + return this; + } + + /** + *

This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage temperature(Double temperature) { + this.temperature = Optional.ofNullable(temperature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "temperature", nulls = Nulls.SKIP) + public _FinalStage temperature(Optional temperature) { + this.temperature = temperature; + return this; + } + + @java.lang.Override + public _FinalStage semanticCachingEnabled(Boolean semanticCachingEnabled) { + this.semanticCachingEnabled = Optional.ofNullable(semanticCachingEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "semanticCachingEnabled", nulls = Nulls.SKIP) + public _FinalStage semanticCachingEnabled(Optional semanticCachingEnabled) { + this.semanticCachingEnabled = semanticCachingEnabled; + return this; + } + + /** + *

These are the fallback models that will be used if the primary model fails. This shouldn't be specified unless you have a specific reason to do so. Vapi will automatically find the fastest fallbacks that make sense.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fallbackModels(List fallbackModels) { + this.fallbackModels = Optional.ofNullable(fallbackModels); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fallbackModels", nulls = Nulls.SKIP) + public _FinalStage fallbackModels(Optional> fallbackModels) { + this.fallbackModels = fallbackModels; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use transient tools, use tools.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toolIds(List toolIds) { + this.toolIds = Optional.ofNullable(toolIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "toolIds", nulls = Nulls.SKIP) + public _FinalStage toolIds(Optional> toolIds) { + this.toolIds = toolIds; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use existing tools, use toolIds.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tools(List tools) { + this.tools = Optional.ofNullable(tools); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tools", nulls = Nulls.SKIP) + public _FinalStage tools(Optional> tools) { + this.tools = tools; + return this; + } + + /** + *

This is the starting state for the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + @java.lang.Override + public OpenAiModel build() { + return new OpenAiModel( + messages, + tools, + toolIds, + model, + fallbackModels, + semanticCachingEnabled, + temperature, + knowledgeBase, + maxTokens, + emotionRecognitionEnabled, + numFastTurns, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/OpenAiModelFallbackModelsItem.java b/src/main/java/com/vapi/api/types/OpenAiModelFallbackModelsItem.java new file mode 100644 index 0000000..0f2bb6b --- /dev/null +++ b/src/main/java/com/vapi/api/types/OpenAiModelFallbackModelsItem.java @@ -0,0 +1,54 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum OpenAiModelFallbackModelsItem { + GPT_4_O_MINI("gpt-4o-mini"), + + GPT_4_O_MINI_20240718("gpt-4o-mini-2024-07-18"), + + GPT_4_O("gpt-4o"), + + GPT_4_O_20240513("gpt-4o-2024-05-13"), + + GPT_4_O_20240806("gpt-4o-2024-08-06"), + + GPT_4_TURBO("gpt-4-turbo"), + + GPT_4_TURBO_20240409("gpt-4-turbo-2024-04-09"), + + GPT_4_TURBO_PREVIEW("gpt-4-turbo-preview"), + + GPT_40125_PREVIEW("gpt-4-0125-preview"), + + GPT_41106_PREVIEW("gpt-4-1106-preview"), + + GPT_4("gpt-4"), + + GPT_40613("gpt-4-0613"), + + GPT_35_TURBO("gpt-3.5-turbo"), + + GPT_35_TURBO_0125("gpt-3.5-turbo-0125"), + + GPT_35_TURBO_1106("gpt-3.5-turbo-1106"), + + GPT_35_TURBO_16_K("gpt-3.5-turbo-16k"), + + GPT_35_TURBO_0613("gpt-3.5-turbo-0613"); + + private final String value; + + OpenAiModelFallbackModelsItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/OpenAiModelModel.java b/src/main/java/com/vapi/api/types/OpenAiModelModel.java new file mode 100644 index 0000000..61d3bda --- /dev/null +++ b/src/main/java/com/vapi/api/types/OpenAiModelModel.java @@ -0,0 +1,54 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum OpenAiModelModel { + GPT_4_O_MINI("gpt-4o-mini"), + + GPT_4_O_MINI_20240718("gpt-4o-mini-2024-07-18"), + + GPT_4_O("gpt-4o"), + + GPT_4_O_20240513("gpt-4o-2024-05-13"), + + GPT_4_O_20240806("gpt-4o-2024-08-06"), + + GPT_4_TURBO("gpt-4-turbo"), + + GPT_4_TURBO_20240409("gpt-4-turbo-2024-04-09"), + + GPT_4_TURBO_PREVIEW("gpt-4-turbo-preview"), + + GPT_40125_PREVIEW("gpt-4-0125-preview"), + + GPT_41106_PREVIEW("gpt-4-1106-preview"), + + GPT_4("gpt-4"), + + GPT_40613("gpt-4-0613"), + + GPT_35_TURBO("gpt-3.5-turbo"), + + GPT_35_TURBO_0125("gpt-3.5-turbo-0125"), + + GPT_35_TURBO_1106("gpt-3.5-turbo-1106"), + + GPT_35_TURBO_16_K("gpt-3.5-turbo-16k"), + + GPT_35_TURBO_0613("gpt-3.5-turbo-0613"); + + private final String value; + + OpenAiModelModel(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/OpenAiModelToolsItem.java b/src/main/java/com/vapi/api/types/OpenAiModelToolsItem.java new file mode 100644 index 0000000..ff5c421 --- /dev/null +++ b/src/main/java/com/vapi/api/types/OpenAiModelToolsItem.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class OpenAiModelToolsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private OpenAiModelToolsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static OpenAiModelToolsItem dtmf(CreateDtmfToolDto value) { + return new OpenAiModelToolsItem(new DtmfValue(value)); + } + + public static OpenAiModelToolsItem endCall(CreateEndCallToolDto value) { + return new OpenAiModelToolsItem(new EndCallValue(value)); + } + + public static OpenAiModelToolsItem voicemail(CreateVoicemailToolDto value) { + return new OpenAiModelToolsItem(new VoicemailValue(value)); + } + + public static OpenAiModelToolsItem function(CreateFunctionToolDto value) { + return new OpenAiModelToolsItem(new FunctionValue(value)); + } + + public static OpenAiModelToolsItem ghl(CreateGhlToolDto value) { + return new OpenAiModelToolsItem(new GhlValue(value)); + } + + public static OpenAiModelToolsItem make(CreateMakeToolDto value) { + return new OpenAiModelToolsItem(new MakeValue(value)); + } + + public static OpenAiModelToolsItem transferCall(CreateTransferCallToolDto value) { + return new OpenAiModelToolsItem(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OpenAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OpenAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OpenAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OpenAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OpenAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OpenAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OpenAiModelToolsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "OpenAiModelToolsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/OpenAiVoice.java b/src/main/java/com/vapi/api/types/OpenAiVoice.java new file mode 100644 index 0000000..7fab7da --- /dev/null +++ b/src/main/java/com/vapi/api/types/OpenAiVoice.java @@ -0,0 +1,226 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = OpenAiVoice.Builder.class) +public final class OpenAiVoice { + private final Optional fillerInjectionEnabled; + + private final OpenAiVoiceId voiceId; + + private final Optional speed; + + private final Optional chunkPlan; + + private final Map additionalProperties; + + private OpenAiVoice( + Optional fillerInjectionEnabled, + OpenAiVoiceId voiceId, + Optional speed, + Optional chunkPlan, + Map additionalProperties) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + this.voiceId = voiceId; + this.speed = speed; + this.chunkPlan = chunkPlan; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines whether fillers are injected into the model output before inputting it into the voice provider. + *

Default false because you can achieve better results with prompting the model.

+ */ + @JsonProperty("fillerInjectionEnabled") + public Optional getFillerInjectionEnabled() { + return fillerInjectionEnabled; + } + + /** + * @return This is the provider-specific ID that will be used. + */ + @JsonProperty("voiceId") + public OpenAiVoiceId getVoiceId() { + return voiceId; + } + + /** + * @return This is the speed multiplier that will be used. + */ + @JsonProperty("speed") + public Optional getSpeed() { + return speed; + } + + /** + * @return This is the plan for chunking the model output before it is sent to the voice provider. + */ + @JsonProperty("chunkPlan") + public Optional getChunkPlan() { + return chunkPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenAiVoice && equalTo((OpenAiVoice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OpenAiVoice other) { + return fillerInjectionEnabled.equals(other.fillerInjectionEnabled) + && voiceId.equals(other.voiceId) + && speed.equals(other.speed) + && chunkPlan.equals(other.chunkPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fillerInjectionEnabled, this.voiceId, this.speed, this.chunkPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VoiceIdStage builder() { + return new Builder(); + } + + public interface VoiceIdStage { + _FinalStage voiceId(@NotNull OpenAiVoiceId voiceId); + + Builder from(OpenAiVoice other); + } + + public interface _FinalStage { + OpenAiVoice build(); + + _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled); + + _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled); + + _FinalStage speed(Optional speed); + + _FinalStage speed(Double speed); + + _FinalStage chunkPlan(Optional chunkPlan); + + _FinalStage chunkPlan(ChunkPlan chunkPlan); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VoiceIdStage, _FinalStage { + private OpenAiVoiceId voiceId; + + private Optional chunkPlan = Optional.empty(); + + private Optional speed = Optional.empty(); + + private Optional fillerInjectionEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(OpenAiVoice other) { + fillerInjectionEnabled(other.getFillerInjectionEnabled()); + voiceId(other.getVoiceId()); + speed(other.getSpeed()); + chunkPlan(other.getChunkPlan()); + return this; + } + + /** + *

This is the provider-specific ID that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("voiceId") + public _FinalStage voiceId(@NotNull OpenAiVoiceId voiceId) { + this.voiceId = Objects.requireNonNull(voiceId, "voiceId must not be null"); + return this; + } + + /** + *

This is the plan for chunking the model output before it is sent to the voice provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage chunkPlan(ChunkPlan chunkPlan) { + this.chunkPlan = Optional.ofNullable(chunkPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "chunkPlan", nulls = Nulls.SKIP) + public _FinalStage chunkPlan(Optional chunkPlan) { + this.chunkPlan = chunkPlan; + return this; + } + + /** + *

This is the speed multiplier that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage speed(Double speed) { + this.speed = Optional.ofNullable(speed); + return this; + } + + @java.lang.Override + @JsonSetter(value = "speed", nulls = Nulls.SKIP) + public _FinalStage speed(Optional speed) { + this.speed = speed; + return this; + } + + /** + *

This determines whether fillers are injected into the model output before inputting it into the voice provider.

+ *

Default false because you can achieve better results with prompting the model.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled) { + this.fillerInjectionEnabled = Optional.ofNullable(fillerInjectionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fillerInjectionEnabled", nulls = Nulls.SKIP) + public _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + return this; + } + + @java.lang.Override + public OpenAiVoice build() { + return new OpenAiVoice(fillerInjectionEnabled, voiceId, speed, chunkPlan, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/OpenAiVoiceId.java b/src/main/java/com/vapi/api/types/OpenAiVoiceId.java new file mode 100644 index 0000000..7881eb7 --- /dev/null +++ b/src/main/java/com/vapi/api/types/OpenAiVoiceId.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum OpenAiVoiceId { + ALLOY("alloy"), + + ECHO("echo"), + + FABLE("fable"), + + ONYX("onyx"), + + NOVA("nova"), + + SHIMMER("shimmer"); + + private final String value; + + OpenAiVoiceId(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/OpenRouterCredential.java b/src/main/java/com/vapi/api/types/OpenRouterCredential.java new file mode 100644 index 0000000..36443fc --- /dev/null +++ b/src/main/java/com/vapi/api/types/OpenRouterCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = OpenRouterCredential.Builder.class) +public final class OpenRouterCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private OpenRouterCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "openrouter"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenRouterCredential && equalTo((OpenRouterCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OpenRouterCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(OpenRouterCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + OpenRouterCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(OpenRouterCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public OpenRouterCredential build() { + return new OpenRouterCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/OpenRouterModel.java b/src/main/java/com/vapi/api/types/OpenRouterModel.java new file mode 100644 index 0000000..11c83de --- /dev/null +++ b/src/main/java/com/vapi/api/types/OpenRouterModel.java @@ -0,0 +1,441 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = OpenRouterModel.Builder.class) +public final class OpenRouterModel { + private final Optional> messages; + + private final Optional> tools; + + private final Optional> toolIds; + + private final String model; + + private final Optional temperature; + + private final Optional knowledgeBase; + + private final Optional maxTokens; + + private final Optional emotionRecognitionEnabled; + + private final Optional numFastTurns; + + private final Map additionalProperties; + + private OpenRouterModel( + Optional> messages, + Optional> tools, + Optional> toolIds, + String model, + Optional temperature, + Optional knowledgeBase, + Optional maxTokens, + Optional emotionRecognitionEnabled, + Optional numFastTurns, + Map additionalProperties) { + this.messages = messages; + this.tools = tools; + this.toolIds = toolIds; + this.model = model; + this.temperature = temperature; + this.knowledgeBase = knowledgeBase; + this.maxTokens = maxTokens; + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + this.numFastTurns = numFastTurns; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the starting state for the conversation. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return These are the tools that the assistant can use during the call. To use existing tools, use toolIds. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("tools") + public Optional> getTools() { + return tools; + } + + /** + * @return These are the tools that the assistant can use during the call. To use transient tools, use tools. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("toolIds") + public Optional> getToolIds() { + return toolIds; + } + + /** + * @return This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + */ + @JsonProperty("model") + public String getModel() { + return model; + } + + /** + * @return This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + */ + @JsonProperty("temperature") + public Optional getTemperature() { + return temperature; + } + + /** + * @return These are the options for the knowledge base. + */ + @JsonProperty("knowledgeBase") + public Optional getKnowledgeBase() { + return knowledgeBase; + } + + /** + * @return This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. + */ + @JsonProperty("maxTokens") + public Optional getMaxTokens() { + return maxTokens; + } + + /** + * @return This determines whether we detect user's emotion while they speak and send it as an additional info to model. + *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ */ + @JsonProperty("emotionRecognitionEnabled") + public Optional getEmotionRecognitionEnabled() { + return emotionRecognitionEnabled; + } + + /** + * @return This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai. + *

Default is 0.

+ *

@default 0

+ */ + @JsonProperty("numFastTurns") + public Optional getNumFastTurns() { + return numFastTurns; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OpenRouterModel && equalTo((OpenRouterModel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OpenRouterModel other) { + return messages.equals(other.messages) + && tools.equals(other.tools) + && toolIds.equals(other.toolIds) + && model.equals(other.model) + && temperature.equals(other.temperature) + && knowledgeBase.equals(other.knowledgeBase) + && maxTokens.equals(other.maxTokens) + && emotionRecognitionEnabled.equals(other.emotionRecognitionEnabled) + && numFastTurns.equals(other.numFastTurns); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.messages, + this.tools, + this.toolIds, + this.model, + this.temperature, + this.knowledgeBase, + this.maxTokens, + this.emotionRecognitionEnabled, + this.numFastTurns); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + _FinalStage model(@NotNull String model); + + Builder from(OpenRouterModel other); + } + + public interface _FinalStage { + OpenRouterModel build(); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage tools(Optional> tools); + + _FinalStage tools(List tools); + + _FinalStage toolIds(Optional> toolIds); + + _FinalStage toolIds(List toolIds); + + _FinalStage temperature(Optional temperature); + + _FinalStage temperature(Double temperature); + + _FinalStage knowledgeBase(Optional knowledgeBase); + + _FinalStage knowledgeBase(KnowledgeBase knowledgeBase); + + _FinalStage maxTokens(Optional maxTokens); + + _FinalStage maxTokens(Double maxTokens); + + _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled); + + _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled); + + _FinalStage numFastTurns(Optional numFastTurns); + + _FinalStage numFastTurns(Double numFastTurns); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, _FinalStage { + private String model; + + private Optional numFastTurns = Optional.empty(); + + private Optional emotionRecognitionEnabled = Optional.empty(); + + private Optional maxTokens = Optional.empty(); + + private Optional knowledgeBase = Optional.empty(); + + private Optional temperature = Optional.empty(); + + private Optional> toolIds = Optional.empty(); + + private Optional> tools = Optional.empty(); + + private Optional> messages = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(OpenRouterModel other) { + messages(other.getMessages()); + tools(other.getTools()); + toolIds(other.getToolIds()); + model(other.getModel()); + temperature(other.getTemperature()); + knowledgeBase(other.getKnowledgeBase()); + maxTokens(other.getMaxTokens()); + emotionRecognitionEnabled(other.getEmotionRecognitionEnabled()); + numFastTurns(other.getNumFastTurns()); + return this; + } + + /** + *

This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("model") + public _FinalStage model(@NotNull String model) { + this.model = Objects.requireNonNull(model, "model must not be null"); + return this; + } + + /** + *

This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai.

+ *

Default is 0.

+ *

@default 0

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numFastTurns(Double numFastTurns) { + this.numFastTurns = Optional.ofNullable(numFastTurns); + return this; + } + + @java.lang.Override + @JsonSetter(value = "numFastTurns", nulls = Nulls.SKIP) + public _FinalStage numFastTurns(Optional numFastTurns) { + this.numFastTurns = numFastTurns; + return this; + } + + /** + *

This determines whether we detect user's emotion while they speak and send it as an additional info to model.

+ *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = Optional.ofNullable(emotionRecognitionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "emotionRecognitionEnabled", nulls = Nulls.SKIP) + public _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + return this; + } + + /** + *

This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxTokens(Double maxTokens) { + this.maxTokens = Optional.ofNullable(maxTokens); + return this; + } + + @java.lang.Override + @JsonSetter(value = "maxTokens", nulls = Nulls.SKIP) + public _FinalStage maxTokens(Optional maxTokens) { + this.maxTokens = maxTokens; + return this; + } + + /** + *

These are the options for the knowledge base.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage knowledgeBase(KnowledgeBase knowledgeBase) { + this.knowledgeBase = Optional.ofNullable(knowledgeBase); + return this; + } + + @java.lang.Override + @JsonSetter(value = "knowledgeBase", nulls = Nulls.SKIP) + public _FinalStage knowledgeBase(Optional knowledgeBase) { + this.knowledgeBase = knowledgeBase; + return this; + } + + /** + *

This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage temperature(Double temperature) { + this.temperature = Optional.ofNullable(temperature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "temperature", nulls = Nulls.SKIP) + public _FinalStage temperature(Optional temperature) { + this.temperature = temperature; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use transient tools, use tools.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toolIds(List toolIds) { + this.toolIds = Optional.ofNullable(toolIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "toolIds", nulls = Nulls.SKIP) + public _FinalStage toolIds(Optional> toolIds) { + this.toolIds = toolIds; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use existing tools, use toolIds.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tools(List tools) { + this.tools = Optional.ofNullable(tools); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tools", nulls = Nulls.SKIP) + public _FinalStage tools(Optional> tools) { + this.tools = tools; + return this; + } + + /** + *

This is the starting state for the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + @java.lang.Override + public OpenRouterModel build() { + return new OpenRouterModel( + messages, + tools, + toolIds, + model, + temperature, + knowledgeBase, + maxTokens, + emotionRecognitionEnabled, + numFastTurns, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/OpenRouterModelToolsItem.java b/src/main/java/com/vapi/api/types/OpenRouterModelToolsItem.java new file mode 100644 index 0000000..2729c7d --- /dev/null +++ b/src/main/java/com/vapi/api/types/OpenRouterModelToolsItem.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class OpenRouterModelToolsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private OpenRouterModelToolsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static OpenRouterModelToolsItem dtmf(CreateDtmfToolDto value) { + return new OpenRouterModelToolsItem(new DtmfValue(value)); + } + + public static OpenRouterModelToolsItem endCall(CreateEndCallToolDto value) { + return new OpenRouterModelToolsItem(new EndCallValue(value)); + } + + public static OpenRouterModelToolsItem voicemail(CreateVoicemailToolDto value) { + return new OpenRouterModelToolsItem(new VoicemailValue(value)); + } + + public static OpenRouterModelToolsItem function(CreateFunctionToolDto value) { + return new OpenRouterModelToolsItem(new FunctionValue(value)); + } + + public static OpenRouterModelToolsItem ghl(CreateGhlToolDto value) { + return new OpenRouterModelToolsItem(new GhlValue(value)); + } + + public static OpenRouterModelToolsItem make(CreateMakeToolDto value) { + return new OpenRouterModelToolsItem(new MakeValue(value)); + } + + public static OpenRouterModelToolsItem transferCall(CreateTransferCallToolDto value) { + return new OpenRouterModelToolsItem(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OpenRouterModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OpenRouterModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OpenRouterModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OpenRouterModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OpenRouterModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OpenRouterModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OpenRouterModelToolsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "OpenRouterModelToolsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/Org.java b/src/main/java/com/vapi/api/types/Org.java new file mode 100644 index 0000000..44c22b3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/Org.java @@ -0,0 +1,658 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Org.Builder.class) +public final class Org { + private final Optional hipaaEnabled; + + private final String id; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional stripeCustomerId; + + private final Optional stripeSubscriptionId; + + private final Optional stripeSubscriptionItemId; + + private final Optional stripeSubscriptionCurrentPeriodStart; + + private final Optional stripeSubscriptionStatus; + + private final Optional plan; + + private final Optional name; + + private final Optional billingLimit; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Optional concurrencyLimit; + + private final Map additionalProperties; + + private Org( + Optional hipaaEnabled, + String id, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional stripeCustomerId, + Optional stripeSubscriptionId, + Optional stripeSubscriptionItemId, + Optional stripeSubscriptionCurrentPeriodStart, + Optional stripeSubscriptionStatus, + Optional plan, + Optional name, + Optional billingLimit, + Optional serverUrl, + Optional serverUrlSecret, + Optional concurrencyLimit, + Map additionalProperties) { + this.hipaaEnabled = hipaaEnabled; + this.id = id; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.stripeCustomerId = stripeCustomerId; + this.stripeSubscriptionId = stripeSubscriptionId; + this.stripeSubscriptionItemId = stripeSubscriptionItemId; + this.stripeSubscriptionCurrentPeriodStart = stripeSubscriptionCurrentPeriodStart; + this.stripeSubscriptionStatus = stripeSubscriptionStatus; + this.plan = plan; + this.name = name; + this.billingLimit = billingLimit; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.concurrencyLimit = concurrencyLimit; + this.additionalProperties = additionalProperties; + } + + /** + * @return When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false. + * When HIPAA is enabled, only OpenAI/Custom LLM or Azure Providers will be available for LLM and Voice respectively. + * This is due to the compliance requirements of HIPAA. Other providers may not meet these requirements. + */ + @JsonProperty("hipaaEnabled") + public Optional getHipaaEnabled() { + return hipaaEnabled; + } + + /** + * @return This is the unique identifier for the org. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the ISO 8601 date-time string of when the org was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the org was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the Stripe customer for the org. + */ + @JsonProperty("stripeCustomerId") + public Optional getStripeCustomerId() { + return stripeCustomerId; + } + + /** + * @return This is the subscription for the org. + */ + @JsonProperty("stripeSubscriptionId") + public Optional getStripeSubscriptionId() { + return stripeSubscriptionId; + } + + /** + * @return This is the subscription's subscription item. + */ + @JsonProperty("stripeSubscriptionItemId") + public Optional getStripeSubscriptionItemId() { + return stripeSubscriptionItemId; + } + + /** + * @return This is the subscription's current period start. + */ + @JsonProperty("stripeSubscriptionCurrentPeriodStart") + public Optional getStripeSubscriptionCurrentPeriodStart() { + return stripeSubscriptionCurrentPeriodStart; + } + + /** + * @return This is the subscription's status. + */ + @JsonProperty("stripeSubscriptionStatus") + public Optional getStripeSubscriptionStatus() { + return stripeSubscriptionStatus; + } + + /** + * @return This is the plan for the org. + */ + @JsonProperty("plan") + public Optional getPlan() { + return plan; + } + + /** + * @return This is the name of the org. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the monthly billing limit for the org. To go beyond $1000/mo, please contact us at support@vapi.ai. + */ + @JsonProperty("billingLimit") + public Optional getBillingLimit() { + return billingLimit; + } + + /** + * @return This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports. + *

All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation.

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret. + */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + /** + * @return This is the concurrency limit for the org. This is the maximum number of calls that can be active at any given time. To go beyond 10, please contact us at support@vapi.ai. + */ + @JsonProperty("concurrencyLimit") + public Optional getConcurrencyLimit() { + return concurrencyLimit; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Org && equalTo((Org) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Org other) { + return hipaaEnabled.equals(other.hipaaEnabled) + && id.equals(other.id) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && stripeCustomerId.equals(other.stripeCustomerId) + && stripeSubscriptionId.equals(other.stripeSubscriptionId) + && stripeSubscriptionItemId.equals(other.stripeSubscriptionItemId) + && stripeSubscriptionCurrentPeriodStart.equals(other.stripeSubscriptionCurrentPeriodStart) + && stripeSubscriptionStatus.equals(other.stripeSubscriptionStatus) + && plan.equals(other.plan) + && name.equals(other.name) + && billingLimit.equals(other.billingLimit) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret) + && concurrencyLimit.equals(other.concurrencyLimit); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.hipaaEnabled, + this.id, + this.createdAt, + this.updatedAt, + this.stripeCustomerId, + this.stripeSubscriptionId, + this.stripeSubscriptionItemId, + this.stripeSubscriptionCurrentPeriodStart, + this.stripeSubscriptionStatus, + this.plan, + this.name, + this.billingLimit, + this.serverUrl, + this.serverUrlSecret, + this.concurrencyLimit); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + CreatedAtStage id(@NotNull String id); + + Builder from(Org other); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + Org build(); + + _FinalStage hipaaEnabled(Optional hipaaEnabled); + + _FinalStage hipaaEnabled(Boolean hipaaEnabled); + + _FinalStage stripeCustomerId(Optional stripeCustomerId); + + _FinalStage stripeCustomerId(String stripeCustomerId); + + _FinalStage stripeSubscriptionId(Optional stripeSubscriptionId); + + _FinalStage stripeSubscriptionId(String stripeSubscriptionId); + + _FinalStage stripeSubscriptionItemId(Optional stripeSubscriptionItemId); + + _FinalStage stripeSubscriptionItemId(String stripeSubscriptionItemId); + + _FinalStage stripeSubscriptionCurrentPeriodStart(Optional stripeSubscriptionCurrentPeriodStart); + + _FinalStage stripeSubscriptionCurrentPeriodStart(OffsetDateTime stripeSubscriptionCurrentPeriodStart); + + _FinalStage stripeSubscriptionStatus(Optional stripeSubscriptionStatus); + + _FinalStage stripeSubscriptionStatus(String stripeSubscriptionStatus); + + _FinalStage plan(Optional plan); + + _FinalStage plan(OrgPlan plan); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage billingLimit(Optional billingLimit); + + _FinalStage billingLimit(Double billingLimit); + + _FinalStage serverUrl(Optional serverUrl); + + _FinalStage serverUrl(String serverUrl); + + _FinalStage serverUrlSecret(Optional serverUrlSecret); + + _FinalStage serverUrlSecret(String serverUrlSecret); + + _FinalStage concurrencyLimit(Optional concurrencyLimit); + + _FinalStage concurrencyLimit(Double concurrencyLimit); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional concurrencyLimit = Optional.empty(); + + private Optional serverUrlSecret = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional billingLimit = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional plan = Optional.empty(); + + private Optional stripeSubscriptionStatus = Optional.empty(); + + private Optional stripeSubscriptionCurrentPeriodStart = Optional.empty(); + + private Optional stripeSubscriptionItemId = Optional.empty(); + + private Optional stripeSubscriptionId = Optional.empty(); + + private Optional stripeCustomerId = Optional.empty(); + + private Optional hipaaEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Org other) { + hipaaEnabled(other.getHipaaEnabled()); + id(other.getId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + stripeCustomerId(other.getStripeCustomerId()); + stripeSubscriptionId(other.getStripeSubscriptionId()); + stripeSubscriptionItemId(other.getStripeSubscriptionItemId()); + stripeSubscriptionCurrentPeriodStart(other.getStripeSubscriptionCurrentPeriodStart()); + stripeSubscriptionStatus(other.getStripeSubscriptionStatus()); + plan(other.getPlan()); + name(other.getName()); + billingLimit(other.getBillingLimit()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + concurrencyLimit(other.getConcurrencyLimit()); + return this; + } + + /** + *

This is the unique identifier for the org.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public CreatedAtStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the org was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the org was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the concurrency limit for the org. This is the maximum number of calls that can be active at any given time. To go beyond 10, please contact us at support@vapi.ai.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage concurrencyLimit(Double concurrencyLimit) { + this.concurrencyLimit = Optional.ofNullable(concurrencyLimit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "concurrencyLimit", nulls = Nulls.SKIP) + public _FinalStage concurrencyLimit(Optional concurrencyLimit) { + this.concurrencyLimit = concurrencyLimit; + return this; + } + + /** + *

This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public _FinalStage serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + /** + *

This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports.

+ *

All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public _FinalStage serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + /** + *

This is the monthly billing limit for the org. To go beyond $1000/mo, please contact us at support@vapi.ai.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage billingLimit(Double billingLimit) { + this.billingLimit = Optional.ofNullable(billingLimit); + return this; + } + + @java.lang.Override + @JsonSetter(value = "billingLimit", nulls = Nulls.SKIP) + public _FinalStage billingLimit(Optional billingLimit) { + this.billingLimit = billingLimit; + return this; + } + + /** + *

This is the name of the org. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the plan for the org.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage plan(OrgPlan plan) { + this.plan = Optional.ofNullable(plan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "plan", nulls = Nulls.SKIP) + public _FinalStage plan(Optional plan) { + this.plan = plan; + return this; + } + + /** + *

This is the subscription's status.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage stripeSubscriptionStatus(String stripeSubscriptionStatus) { + this.stripeSubscriptionStatus = Optional.ofNullable(stripeSubscriptionStatus); + return this; + } + + @java.lang.Override + @JsonSetter(value = "stripeSubscriptionStatus", nulls = Nulls.SKIP) + public _FinalStage stripeSubscriptionStatus(Optional stripeSubscriptionStatus) { + this.stripeSubscriptionStatus = stripeSubscriptionStatus; + return this; + } + + /** + *

This is the subscription's current period start.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage stripeSubscriptionCurrentPeriodStart(OffsetDateTime stripeSubscriptionCurrentPeriodStart) { + this.stripeSubscriptionCurrentPeriodStart = Optional.ofNullable(stripeSubscriptionCurrentPeriodStart); + return this; + } + + @java.lang.Override + @JsonSetter(value = "stripeSubscriptionCurrentPeriodStart", nulls = Nulls.SKIP) + public _FinalStage stripeSubscriptionCurrentPeriodStart( + Optional stripeSubscriptionCurrentPeriodStart) { + this.stripeSubscriptionCurrentPeriodStart = stripeSubscriptionCurrentPeriodStart; + return this; + } + + /** + *

This is the subscription's subscription item.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage stripeSubscriptionItemId(String stripeSubscriptionItemId) { + this.stripeSubscriptionItemId = Optional.ofNullable(stripeSubscriptionItemId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "stripeSubscriptionItemId", nulls = Nulls.SKIP) + public _FinalStage stripeSubscriptionItemId(Optional stripeSubscriptionItemId) { + this.stripeSubscriptionItemId = stripeSubscriptionItemId; + return this; + } + + /** + *

This is the subscription for the org.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage stripeSubscriptionId(String stripeSubscriptionId) { + this.stripeSubscriptionId = Optional.ofNullable(stripeSubscriptionId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "stripeSubscriptionId", nulls = Nulls.SKIP) + public _FinalStage stripeSubscriptionId(Optional stripeSubscriptionId) { + this.stripeSubscriptionId = stripeSubscriptionId; + return this; + } + + /** + *

This is the Stripe customer for the org.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage stripeCustomerId(String stripeCustomerId) { + this.stripeCustomerId = Optional.ofNullable(stripeCustomerId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "stripeCustomerId", nulls = Nulls.SKIP) + public _FinalStage stripeCustomerId(Optional stripeCustomerId) { + this.stripeCustomerId = stripeCustomerId; + return this; + } + + /** + *

When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false. + * When HIPAA is enabled, only OpenAI/Custom LLM or Azure Providers will be available for LLM and Voice respectively. + * This is due to the compliance requirements of HIPAA. Other providers may not meet these requirements.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage hipaaEnabled(Boolean hipaaEnabled) { + this.hipaaEnabled = Optional.ofNullable(hipaaEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "hipaaEnabled", nulls = Nulls.SKIP) + public _FinalStage hipaaEnabled(Optional hipaaEnabled) { + this.hipaaEnabled = hipaaEnabled; + return this; + } + + @java.lang.Override + public Org build() { + return new Org( + hipaaEnabled, + id, + createdAt, + updatedAt, + stripeCustomerId, + stripeSubscriptionId, + stripeSubscriptionItemId, + stripeSubscriptionCurrentPeriodStart, + stripeSubscriptionStatus, + plan, + name, + billingLimit, + serverUrl, + serverUrlSecret, + concurrencyLimit, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/OrgPlan.java b/src/main/java/com/vapi/api/types/OrgPlan.java new file mode 100644 index 0000000..d250c04 --- /dev/null +++ b/src/main/java/com/vapi/api/types/OrgPlan.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = OrgPlan.Builder.class) +public final class OrgPlan { + private final Optional>> includedProviders; + + private final Optional includedMinutes; + + private final Optional costPerOverageMinute; + + private final Map additionalProperties; + + private OrgPlan( + Optional>> includedProviders, + Optional includedMinutes, + Optional costPerOverageMinute, + Map additionalProperties) { + this.includedProviders = includedProviders; + this.includedMinutes = includedMinutes; + this.costPerOverageMinute = costPerOverageMinute; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("includedProviders") + public Optional>> getIncludedProviders() { + return includedProviders; + } + + @JsonProperty("includedMinutes") + public Optional getIncludedMinutes() { + return includedMinutes; + } + + @JsonProperty("costPerOverageMinute") + public Optional getCostPerOverageMinute() { + return costPerOverageMinute; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OrgPlan && equalTo((OrgPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OrgPlan other) { + return includedProviders.equals(other.includedProviders) + && includedMinutes.equals(other.includedMinutes) + && costPerOverageMinute.equals(other.costPerOverageMinute); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.includedProviders, this.includedMinutes, this.costPerOverageMinute); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional>> includedProviders = Optional.empty(); + + private Optional includedMinutes = Optional.empty(); + + private Optional costPerOverageMinute = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(OrgPlan other) { + includedProviders(other.getIncludedProviders()); + includedMinutes(other.getIncludedMinutes()); + costPerOverageMinute(other.getCostPerOverageMinute()); + return this; + } + + @JsonSetter(value = "includedProviders", nulls = Nulls.SKIP) + public Builder includedProviders(Optional>> includedProviders) { + this.includedProviders = includedProviders; + return this; + } + + public Builder includedProviders(List> includedProviders) { + this.includedProviders = Optional.ofNullable(includedProviders); + return this; + } + + @JsonSetter(value = "includedMinutes", nulls = Nulls.SKIP) + public Builder includedMinutes(Optional includedMinutes) { + this.includedMinutes = includedMinutes; + return this; + } + + public Builder includedMinutes(Double includedMinutes) { + this.includedMinutes = Optional.ofNullable(includedMinutes); + return this; + } + + @JsonSetter(value = "costPerOverageMinute", nulls = Nulls.SKIP) + public Builder costPerOverageMinute(Optional costPerOverageMinute) { + this.costPerOverageMinute = costPerOverageMinute; + return this; + } + + public Builder costPerOverageMinute(Double costPerOverageMinute) { + this.costPerOverageMinute = Optional.ofNullable(costPerOverageMinute); + return this; + } + + public OrgPlan build() { + return new OrgPlan(includedProviders, includedMinutes, costPerOverageMinute, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/OutputTool.java b/src/main/java/com/vapi/api/types/OutputTool.java new file mode 100644 index 0000000..1a775c0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/OutputTool.java @@ -0,0 +1,381 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = OutputTool.Builder.class) +public final class OutputTool { + private final Optional async; + + private final Optional> messages; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private OutputTool( + Optional async, + Optional> messages, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the unique identifier for the tool. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the organization that this tool belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the tool was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the tool was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof OutputTool && equalTo((OutputTool) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(OutputTool other) { + return async.equals(other.async) + && messages.equals(other.messages) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.async, + this.messages, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.function, + this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(OutputTool other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + OutputTool build(); + + _FinalStage async(Optional async); + + _FinalStage async(Boolean async); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage function(Optional function); + + _FinalStage function(OpenAiFunction function); + + _FinalStage server(Optional server); + + _FinalStage server(Server server); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional server = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional async = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(OutputTool other) { + async(other.getAsync()); + messages(other.getMessages()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + /** + *

This is the unique identifier for the tool.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the organization that this tool belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the tool was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the tool was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the server that will be hit when this tool is requested by the model.

+ *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + @java.lang.Override + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public _FinalStage server(Optional server) { + this.server = server; + return this; + } + + /** + *

This is the function definition of the tool.

+ *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @java.lang.Override + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public _FinalStage function(Optional function) { + this.function = function; + return this; + } + + /** + *

These are the messages that will be spoken to the user as the tool is running.

+ *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + /** + *

This determines if the tool is async.

+ *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @java.lang.Override + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public _FinalStage async(Optional async) { + this.async = async; + return this; + } + + @java.lang.Override + public OutputTool build() { + return new OutputTool( + async, messages, id, orgId, createdAt, updatedAt, function, server, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/OutputToolMessagesItem.java b/src/main/java/com/vapi/api/types/OutputToolMessagesItem.java new file mode 100644 index 0000000..d18da5d --- /dev/null +++ b/src/main/java/com/vapi/api/types/OutputToolMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class OutputToolMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private OutputToolMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static OutputToolMessagesItem requestStart(ToolMessageStart value) { + return new OutputToolMessagesItem(new RequestStartValue(value)); + } + + public static OutputToolMessagesItem requestComplete(ToolMessageComplete value) { + return new OutputToolMessagesItem(new RequestCompleteValue(value)); + } + + public static OutputToolMessagesItem requestFailed(ToolMessageFailed value) { + return new OutputToolMessagesItem(new RequestFailedValue(value)); + } + + public static OutputToolMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new OutputToolMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OutputToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OutputToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OutputToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "OutputToolMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "OutputToolMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/PaginationMeta.java b/src/main/java/com/vapi/api/types/PaginationMeta.java new file mode 100644 index 0000000..c57e8d6 --- /dev/null +++ b/src/main/java/com/vapi/api/types/PaginationMeta.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PaginationMeta.Builder.class) +public final class PaginationMeta { + private final double itemsPerPage; + + private final double totalItems; + + private final double currentPage; + + private final Map additionalProperties; + + private PaginationMeta( + double itemsPerPage, double totalItems, double currentPage, Map additionalProperties) { + this.itemsPerPage = itemsPerPage; + this.totalItems = totalItems; + this.currentPage = currentPage; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("itemsPerPage") + public double getItemsPerPage() { + return itemsPerPage; + } + + @JsonProperty("totalItems") + public double getTotalItems() { + return totalItems; + } + + @JsonProperty("currentPage") + public double getCurrentPage() { + return currentPage; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PaginationMeta && equalTo((PaginationMeta) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PaginationMeta other) { + return itemsPerPage == other.itemsPerPage && totalItems == other.totalItems && currentPage == other.currentPage; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.itemsPerPage, this.totalItems, this.currentPage); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ItemsPerPageStage builder() { + return new Builder(); + } + + public interface ItemsPerPageStage { + TotalItemsStage itemsPerPage(double itemsPerPage); + + Builder from(PaginationMeta other); + } + + public interface TotalItemsStage { + CurrentPageStage totalItems(double totalItems); + } + + public interface CurrentPageStage { + _FinalStage currentPage(double currentPage); + } + + public interface _FinalStage { + PaginationMeta build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ItemsPerPageStage, TotalItemsStage, CurrentPageStage, _FinalStage { + private double itemsPerPage; + + private double totalItems; + + private double currentPage; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PaginationMeta other) { + itemsPerPage(other.getItemsPerPage()); + totalItems(other.getTotalItems()); + currentPage(other.getCurrentPage()); + return this; + } + + @java.lang.Override + @JsonSetter("itemsPerPage") + public TotalItemsStage itemsPerPage(double itemsPerPage) { + this.itemsPerPage = itemsPerPage; + return this; + } + + @java.lang.Override + @JsonSetter("totalItems") + public CurrentPageStage totalItems(double totalItems) { + this.totalItems = totalItems; + return this; + } + + @java.lang.Override + @JsonSetter("currentPage") + public _FinalStage currentPage(double currentPage) { + this.currentPage = currentPage; + return this; + } + + @java.lang.Override + public PaginationMeta build() { + return new PaginationMeta(itemsPerPage, totalItems, currentPage, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/PerplexityAiCredential.java b/src/main/java/com/vapi/api/types/PerplexityAiCredential.java new file mode 100644 index 0000000..d9a69b3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/PerplexityAiCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PerplexityAiCredential.Builder.class) +public final class PerplexityAiCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private PerplexityAiCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "perplexity-ai"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PerplexityAiCredential && equalTo((PerplexityAiCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PerplexityAiCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(PerplexityAiCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + PerplexityAiCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PerplexityAiCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public PerplexityAiCredential build() { + return new PerplexityAiCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/PerplexityAiModel.java b/src/main/java/com/vapi/api/types/PerplexityAiModel.java new file mode 100644 index 0000000..f07f962 --- /dev/null +++ b/src/main/java/com/vapi/api/types/PerplexityAiModel.java @@ -0,0 +1,441 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PerplexityAiModel.Builder.class) +public final class PerplexityAiModel { + private final Optional> messages; + + private final Optional> tools; + + private final Optional> toolIds; + + private final String model; + + private final Optional temperature; + + private final Optional knowledgeBase; + + private final Optional maxTokens; + + private final Optional emotionRecognitionEnabled; + + private final Optional numFastTurns; + + private final Map additionalProperties; + + private PerplexityAiModel( + Optional> messages, + Optional> tools, + Optional> toolIds, + String model, + Optional temperature, + Optional knowledgeBase, + Optional maxTokens, + Optional emotionRecognitionEnabled, + Optional numFastTurns, + Map additionalProperties) { + this.messages = messages; + this.tools = tools; + this.toolIds = toolIds; + this.model = model; + this.temperature = temperature; + this.knowledgeBase = knowledgeBase; + this.maxTokens = maxTokens; + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + this.numFastTurns = numFastTurns; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the starting state for the conversation. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return These are the tools that the assistant can use during the call. To use existing tools, use toolIds. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("tools") + public Optional> getTools() { + return tools; + } + + /** + * @return These are the tools that the assistant can use during the call. To use transient tools, use tools. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("toolIds") + public Optional> getToolIds() { + return toolIds; + } + + /** + * @return This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + */ + @JsonProperty("model") + public String getModel() { + return model; + } + + /** + * @return This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + */ + @JsonProperty("temperature") + public Optional getTemperature() { + return temperature; + } + + /** + * @return These are the options for the knowledge base. + */ + @JsonProperty("knowledgeBase") + public Optional getKnowledgeBase() { + return knowledgeBase; + } + + /** + * @return This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. + */ + @JsonProperty("maxTokens") + public Optional getMaxTokens() { + return maxTokens; + } + + /** + * @return This determines whether we detect user's emotion while they speak and send it as an additional info to model. + *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ */ + @JsonProperty("emotionRecognitionEnabled") + public Optional getEmotionRecognitionEnabled() { + return emotionRecognitionEnabled; + } + + /** + * @return This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai. + *

Default is 0.

+ *

@default 0

+ */ + @JsonProperty("numFastTurns") + public Optional getNumFastTurns() { + return numFastTurns; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PerplexityAiModel && equalTo((PerplexityAiModel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PerplexityAiModel other) { + return messages.equals(other.messages) + && tools.equals(other.tools) + && toolIds.equals(other.toolIds) + && model.equals(other.model) + && temperature.equals(other.temperature) + && knowledgeBase.equals(other.knowledgeBase) + && maxTokens.equals(other.maxTokens) + && emotionRecognitionEnabled.equals(other.emotionRecognitionEnabled) + && numFastTurns.equals(other.numFastTurns); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.messages, + this.tools, + this.toolIds, + this.model, + this.temperature, + this.knowledgeBase, + this.maxTokens, + this.emotionRecognitionEnabled, + this.numFastTurns); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + _FinalStage model(@NotNull String model); + + Builder from(PerplexityAiModel other); + } + + public interface _FinalStage { + PerplexityAiModel build(); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage tools(Optional> tools); + + _FinalStage tools(List tools); + + _FinalStage toolIds(Optional> toolIds); + + _FinalStage toolIds(List toolIds); + + _FinalStage temperature(Optional temperature); + + _FinalStage temperature(Double temperature); + + _FinalStage knowledgeBase(Optional knowledgeBase); + + _FinalStage knowledgeBase(KnowledgeBase knowledgeBase); + + _FinalStage maxTokens(Optional maxTokens); + + _FinalStage maxTokens(Double maxTokens); + + _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled); + + _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled); + + _FinalStage numFastTurns(Optional numFastTurns); + + _FinalStage numFastTurns(Double numFastTurns); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, _FinalStage { + private String model; + + private Optional numFastTurns = Optional.empty(); + + private Optional emotionRecognitionEnabled = Optional.empty(); + + private Optional maxTokens = Optional.empty(); + + private Optional knowledgeBase = Optional.empty(); + + private Optional temperature = Optional.empty(); + + private Optional> toolIds = Optional.empty(); + + private Optional> tools = Optional.empty(); + + private Optional> messages = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PerplexityAiModel other) { + messages(other.getMessages()); + tools(other.getTools()); + toolIds(other.getToolIds()); + model(other.getModel()); + temperature(other.getTemperature()); + knowledgeBase(other.getKnowledgeBase()); + maxTokens(other.getMaxTokens()); + emotionRecognitionEnabled(other.getEmotionRecognitionEnabled()); + numFastTurns(other.getNumFastTurns()); + return this; + } + + /** + *

This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("model") + public _FinalStage model(@NotNull String model) { + this.model = Objects.requireNonNull(model, "model must not be null"); + return this; + } + + /** + *

This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai.

+ *

Default is 0.

+ *

@default 0

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numFastTurns(Double numFastTurns) { + this.numFastTurns = Optional.ofNullable(numFastTurns); + return this; + } + + @java.lang.Override + @JsonSetter(value = "numFastTurns", nulls = Nulls.SKIP) + public _FinalStage numFastTurns(Optional numFastTurns) { + this.numFastTurns = numFastTurns; + return this; + } + + /** + *

This determines whether we detect user's emotion while they speak and send it as an additional info to model.

+ *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = Optional.ofNullable(emotionRecognitionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "emotionRecognitionEnabled", nulls = Nulls.SKIP) + public _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + return this; + } + + /** + *

This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxTokens(Double maxTokens) { + this.maxTokens = Optional.ofNullable(maxTokens); + return this; + } + + @java.lang.Override + @JsonSetter(value = "maxTokens", nulls = Nulls.SKIP) + public _FinalStage maxTokens(Optional maxTokens) { + this.maxTokens = maxTokens; + return this; + } + + /** + *

These are the options for the knowledge base.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage knowledgeBase(KnowledgeBase knowledgeBase) { + this.knowledgeBase = Optional.ofNullable(knowledgeBase); + return this; + } + + @java.lang.Override + @JsonSetter(value = "knowledgeBase", nulls = Nulls.SKIP) + public _FinalStage knowledgeBase(Optional knowledgeBase) { + this.knowledgeBase = knowledgeBase; + return this; + } + + /** + *

This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage temperature(Double temperature) { + this.temperature = Optional.ofNullable(temperature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "temperature", nulls = Nulls.SKIP) + public _FinalStage temperature(Optional temperature) { + this.temperature = temperature; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use transient tools, use tools.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toolIds(List toolIds) { + this.toolIds = Optional.ofNullable(toolIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "toolIds", nulls = Nulls.SKIP) + public _FinalStage toolIds(Optional> toolIds) { + this.toolIds = toolIds; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use existing tools, use toolIds.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tools(List tools) { + this.tools = Optional.ofNullable(tools); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tools", nulls = Nulls.SKIP) + public _FinalStage tools(Optional> tools) { + this.tools = tools; + return this; + } + + /** + *

This is the starting state for the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + @java.lang.Override + public PerplexityAiModel build() { + return new PerplexityAiModel( + messages, + tools, + toolIds, + model, + temperature, + knowledgeBase, + maxTokens, + emotionRecognitionEnabled, + numFastTurns, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/PerplexityAiModelToolsItem.java b/src/main/java/com/vapi/api/types/PerplexityAiModelToolsItem.java new file mode 100644 index 0000000..cd5d382 --- /dev/null +++ b/src/main/java/com/vapi/api/types/PerplexityAiModelToolsItem.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class PerplexityAiModelToolsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private PerplexityAiModelToolsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static PerplexityAiModelToolsItem dtmf(CreateDtmfToolDto value) { + return new PerplexityAiModelToolsItem(new DtmfValue(value)); + } + + public static PerplexityAiModelToolsItem endCall(CreateEndCallToolDto value) { + return new PerplexityAiModelToolsItem(new EndCallValue(value)); + } + + public static PerplexityAiModelToolsItem voicemail(CreateVoicemailToolDto value) { + return new PerplexityAiModelToolsItem(new VoicemailValue(value)); + } + + public static PerplexityAiModelToolsItem function(CreateFunctionToolDto value) { + return new PerplexityAiModelToolsItem(new FunctionValue(value)); + } + + public static PerplexityAiModelToolsItem ghl(CreateGhlToolDto value) { + return new PerplexityAiModelToolsItem(new GhlValue(value)); + } + + public static PerplexityAiModelToolsItem make(CreateMakeToolDto value) { + return new PerplexityAiModelToolsItem(new MakeValue(value)); + } + + public static PerplexityAiModelToolsItem transferCall(CreateTransferCallToolDto value) { + return new PerplexityAiModelToolsItem(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PerplexityAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PerplexityAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PerplexityAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PerplexityAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PerplexityAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PerplexityAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "PerplexityAiModelToolsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "PerplexityAiModelToolsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/PlayHtCredential.java b/src/main/java/com/vapi/api/types/PlayHtCredential.java new file mode 100644 index 0000000..7d003c4 --- /dev/null +++ b/src/main/java/com/vapi/api/types/PlayHtCredential.java @@ -0,0 +1,266 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PlayHtCredential.Builder.class) +public final class PlayHtCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final String userId; + + private final Map additionalProperties; + + private PlayHtCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + String userId, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "playht"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonProperty("userId") + public String getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlayHtCredential && equalTo((PlayHtCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlayHtCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(PlayHtCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + UserIdStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface UserIdStage { + _FinalStage userId(@NotNull String userId); + } + + public interface _FinalStage { + PlayHtCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, UserIdStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private String userId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlayHtCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + userId(other.getUserId()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public UserIdStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("userId") + public _FinalStage userId(@NotNull String userId) { + this.userId = Objects.requireNonNull(userId, "userId must not be null"); + return this; + } + + @java.lang.Override + public PlayHtCredential build() { + return new PlayHtCredential(apiKey, id, orgId, createdAt, updatedAt, userId, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/PlayHtVoice.java b/src/main/java/com/vapi/api/types/PlayHtVoice.java new file mode 100644 index 0000000..8d17353 --- /dev/null +++ b/src/main/java/com/vapi/api/types/PlayHtVoice.java @@ -0,0 +1,430 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PlayHtVoice.Builder.class) +public final class PlayHtVoice { + private final Optional fillerInjectionEnabled; + + private final PlayHtVoiceVoiceId voiceId; + + private final Optional speed; + + private final Optional temperature; + + private final Optional emotion; + + private final Optional voiceGuidance; + + private final Optional styleGuidance; + + private final Optional textGuidance; + + private final Optional chunkPlan; + + private final Map additionalProperties; + + private PlayHtVoice( + Optional fillerInjectionEnabled, + PlayHtVoiceVoiceId voiceId, + Optional speed, + Optional temperature, + Optional emotion, + Optional voiceGuidance, + Optional styleGuidance, + Optional textGuidance, + Optional chunkPlan, + Map additionalProperties) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + this.voiceId = voiceId; + this.speed = speed; + this.temperature = temperature; + this.emotion = emotion; + this.voiceGuidance = voiceGuidance; + this.styleGuidance = styleGuidance; + this.textGuidance = textGuidance; + this.chunkPlan = chunkPlan; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines whether fillers are injected into the model output before inputting it into the voice provider. + *

Default false because you can achieve better results with prompting the model.

+ */ + @JsonProperty("fillerInjectionEnabled") + public Optional getFillerInjectionEnabled() { + return fillerInjectionEnabled; + } + + /** + * @return This is the provider-specific ID that will be used. + */ + @JsonProperty("voiceId") + public PlayHtVoiceVoiceId getVoiceId() { + return voiceId; + } + + /** + * @return This is the speed multiplier that will be used. + */ + @JsonProperty("speed") + public Optional getSpeed() { + return speed; + } + + /** + * @return A floating point number between 0, exclusive, and 2, inclusive. If equal to null or not provided, the model's default temperature will be used. The temperature parameter controls variance. Lower temperatures result in more predictable results, higher temperatures allow each run to vary more, so the voice may sound less like the baseline voice. + */ + @JsonProperty("temperature") + public Optional getTemperature() { + return temperature; + } + + /** + * @return An emotion to be applied to the speech. + */ + @JsonProperty("emotion") + public Optional getEmotion() { + return emotion; + } + + /** + * @return A number between 1 and 6. Use lower numbers to reduce how unique your chosen voice will be compared to other voices. + */ + @JsonProperty("voiceGuidance") + public Optional getVoiceGuidance() { + return voiceGuidance; + } + + /** + * @return A number between 1 and 30. Use lower numbers to to reduce how strong your chosen emotion will be. Higher numbers will create a very emotional performance. + */ + @JsonProperty("styleGuidance") + public Optional getStyleGuidance() { + return styleGuidance; + } + + /** + * @return A number between 1 and 2. This number influences how closely the generated speech adheres to the input text. Use lower values to create more fluid speech, but with a higher chance of deviating from the input text. Higher numbers will make the generated speech more accurate to the input text, ensuring that the words spoken align closely with the provided text. + */ + @JsonProperty("textGuidance") + public Optional getTextGuidance() { + return textGuidance; + } + + /** + * @return This is the plan for chunking the model output before it is sent to the voice provider. + */ + @JsonProperty("chunkPlan") + public Optional getChunkPlan() { + return chunkPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlayHtVoice && equalTo((PlayHtVoice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PlayHtVoice other) { + return fillerInjectionEnabled.equals(other.fillerInjectionEnabled) + && voiceId.equals(other.voiceId) + && speed.equals(other.speed) + && temperature.equals(other.temperature) + && emotion.equals(other.emotion) + && voiceGuidance.equals(other.voiceGuidance) + && styleGuidance.equals(other.styleGuidance) + && textGuidance.equals(other.textGuidance) + && chunkPlan.equals(other.chunkPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fillerInjectionEnabled, + this.voiceId, + this.speed, + this.temperature, + this.emotion, + this.voiceGuidance, + this.styleGuidance, + this.textGuidance, + this.chunkPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VoiceIdStage builder() { + return new Builder(); + } + + public interface VoiceIdStage { + _FinalStage voiceId(@NotNull PlayHtVoiceVoiceId voiceId); + + Builder from(PlayHtVoice other); + } + + public interface _FinalStage { + PlayHtVoice build(); + + _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled); + + _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled); + + _FinalStage speed(Optional speed); + + _FinalStage speed(Double speed); + + _FinalStage temperature(Optional temperature); + + _FinalStage temperature(Double temperature); + + _FinalStage emotion(Optional emotion); + + _FinalStage emotion(PlayHtVoiceEmotion emotion); + + _FinalStage voiceGuidance(Optional voiceGuidance); + + _FinalStage voiceGuidance(Double voiceGuidance); + + _FinalStage styleGuidance(Optional styleGuidance); + + _FinalStage styleGuidance(Double styleGuidance); + + _FinalStage textGuidance(Optional textGuidance); + + _FinalStage textGuidance(Double textGuidance); + + _FinalStage chunkPlan(Optional chunkPlan); + + _FinalStage chunkPlan(ChunkPlan chunkPlan); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VoiceIdStage, _FinalStage { + private PlayHtVoiceVoiceId voiceId; + + private Optional chunkPlan = Optional.empty(); + + private Optional textGuidance = Optional.empty(); + + private Optional styleGuidance = Optional.empty(); + + private Optional voiceGuidance = Optional.empty(); + + private Optional emotion = Optional.empty(); + + private Optional temperature = Optional.empty(); + + private Optional speed = Optional.empty(); + + private Optional fillerInjectionEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PlayHtVoice other) { + fillerInjectionEnabled(other.getFillerInjectionEnabled()); + voiceId(other.getVoiceId()); + speed(other.getSpeed()); + temperature(other.getTemperature()); + emotion(other.getEmotion()); + voiceGuidance(other.getVoiceGuidance()); + styleGuidance(other.getStyleGuidance()); + textGuidance(other.getTextGuidance()); + chunkPlan(other.getChunkPlan()); + return this; + } + + /** + *

This is the provider-specific ID that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("voiceId") + public _FinalStage voiceId(@NotNull PlayHtVoiceVoiceId voiceId) { + this.voiceId = Objects.requireNonNull(voiceId, "voiceId must not be null"); + return this; + } + + /** + *

This is the plan for chunking the model output before it is sent to the voice provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage chunkPlan(ChunkPlan chunkPlan) { + this.chunkPlan = Optional.ofNullable(chunkPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "chunkPlan", nulls = Nulls.SKIP) + public _FinalStage chunkPlan(Optional chunkPlan) { + this.chunkPlan = chunkPlan; + return this; + } + + /** + *

A number between 1 and 2. This number influences how closely the generated speech adheres to the input text. Use lower values to create more fluid speech, but with a higher chance of deviating from the input text. Higher numbers will make the generated speech more accurate to the input text, ensuring that the words spoken align closely with the provided text.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage textGuidance(Double textGuidance) { + this.textGuidance = Optional.ofNullable(textGuidance); + return this; + } + + @java.lang.Override + @JsonSetter(value = "textGuidance", nulls = Nulls.SKIP) + public _FinalStage textGuidance(Optional textGuidance) { + this.textGuidance = textGuidance; + return this; + } + + /** + *

A number between 1 and 30. Use lower numbers to to reduce how strong your chosen emotion will be. Higher numbers will create a very emotional performance.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage styleGuidance(Double styleGuidance) { + this.styleGuidance = Optional.ofNullable(styleGuidance); + return this; + } + + @java.lang.Override + @JsonSetter(value = "styleGuidance", nulls = Nulls.SKIP) + public _FinalStage styleGuidance(Optional styleGuidance) { + this.styleGuidance = styleGuidance; + return this; + } + + /** + *

A number between 1 and 6. Use lower numbers to reduce how unique your chosen voice will be compared to other voices.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage voiceGuidance(Double voiceGuidance) { + this.voiceGuidance = Optional.ofNullable(voiceGuidance); + return this; + } + + @java.lang.Override + @JsonSetter(value = "voiceGuidance", nulls = Nulls.SKIP) + public _FinalStage voiceGuidance(Optional voiceGuidance) { + this.voiceGuidance = voiceGuidance; + return this; + } + + /** + *

An emotion to be applied to the speech.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emotion(PlayHtVoiceEmotion emotion) { + this.emotion = Optional.ofNullable(emotion); + return this; + } + + @java.lang.Override + @JsonSetter(value = "emotion", nulls = Nulls.SKIP) + public _FinalStage emotion(Optional emotion) { + this.emotion = emotion; + return this; + } + + /** + *

A floating point number between 0, exclusive, and 2, inclusive. If equal to null or not provided, the model's default temperature will be used. The temperature parameter controls variance. Lower temperatures result in more predictable results, higher temperatures allow each run to vary more, so the voice may sound less like the baseline voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage temperature(Double temperature) { + this.temperature = Optional.ofNullable(temperature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "temperature", nulls = Nulls.SKIP) + public _FinalStage temperature(Optional temperature) { + this.temperature = temperature; + return this; + } + + /** + *

This is the speed multiplier that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage speed(Double speed) { + this.speed = Optional.ofNullable(speed); + return this; + } + + @java.lang.Override + @JsonSetter(value = "speed", nulls = Nulls.SKIP) + public _FinalStage speed(Optional speed) { + this.speed = speed; + return this; + } + + /** + *

This determines whether fillers are injected into the model output before inputting it into the voice provider.

+ *

Default false because you can achieve better results with prompting the model.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled) { + this.fillerInjectionEnabled = Optional.ofNullable(fillerInjectionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fillerInjectionEnabled", nulls = Nulls.SKIP) + public _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + return this; + } + + @java.lang.Override + public PlayHtVoice build() { + return new PlayHtVoice( + fillerInjectionEnabled, + voiceId, + speed, + temperature, + emotion, + voiceGuidance, + styleGuidance, + textGuidance, + chunkPlan, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/PlayHtVoiceEmotion.java b/src/main/java/com/vapi/api/types/PlayHtVoiceEmotion.java new file mode 100644 index 0000000..9bbebe0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/PlayHtVoiceEmotion.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum PlayHtVoiceEmotion { + FEMALE_HAPPY("female_happy"), + + FEMALE_SAD("female_sad"), + + FEMALE_ANGRY("female_angry"), + + FEMALE_FEARFUL("female_fearful"), + + FEMALE_DISGUST("female_disgust"), + + FEMALE_SURPRISED("female_surprised"), + + MALE_HAPPY("male_happy"), + + MALE_SAD("male_sad"), + + MALE_ANGRY("male_angry"), + + MALE_FEARFUL("male_fearful"), + + MALE_DISGUST("male_disgust"), + + MALE_SURPRISED("male_surprised"); + + private final String value; + + PlayHtVoiceEmotion(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/PlayHtVoiceVoiceId.java b/src/main/java/com/vapi/api/types/PlayHtVoiceVoiceId.java new file mode 100644 index 0000000..a7ed442 --- /dev/null +++ b/src/main/java/com/vapi/api/types/PlayHtVoiceVoiceId.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.vapi.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = PlayHtVoiceVoiceId.Deserializer.class) +public final class PlayHtVoiceVoiceId { + private final Object value; + + private final int type; + + private PlayHtVoiceVoiceId(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((PlayHtVoiceVoiceId) this.value); + } else if (this.type == 1) { + return visitor.visit((String) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlayHtVoiceVoiceId && equalTo((PlayHtVoiceVoiceId) other); + } + + private boolean equalTo(PlayHtVoiceVoiceId other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static PlayHtVoiceVoiceId of(PlayHtVoiceVoiceId value) { + return new PlayHtVoiceVoiceId(value, 0); + } + + public static PlayHtVoiceVoiceId of(String value) { + return new PlayHtVoiceVoiceId(value, 1); + } + + public interface Visitor { + T visit(PlayHtVoiceVoiceId value); + + T visit(String value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(PlayHtVoiceVoiceId.class); + } + + @java.lang.Override + public PlayHtVoiceVoiceId deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, PlayHtVoiceVoiceId.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (IllegalArgumentException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/vapi/api/types/PunctuationBoundary.java b/src/main/java/com/vapi/api/types/PunctuationBoundary.java new file mode 100644 index 0000000..8585e53 --- /dev/null +++ b/src/main/java/com/vapi/api/types/PunctuationBoundary.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum PunctuationBoundary { + CIRCLE("。"), + + FULL_WIDTH_COMMA(","), + + DOT("."), + + EXCLAMATION("!"), + + QUESTION("?"), + + SEMICOLON(";"), + + PARENTHESIS(")"), + + ARABIC_COMMA("،"), + + URDU_FULL_STOP("۔"), + + BENGALI_FULL_STOP("।"), + + DOUBLE_DANDA("॥"), + + PIPE("|"), + + DOUBLE_PIPE("||"), + + HALF_WIDTH_COMMA(","), + + COLON(":"); + + private final String value; + + PunctuationBoundary(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/RegexOption.java b/src/main/java/com/vapi/api/types/RegexOption.java new file mode 100644 index 0000000..a6434f0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/RegexOption.java @@ -0,0 +1,150 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RegexOption.Builder.class) +public final class RegexOption { + private final RegexOptionType type; + + private final boolean enabled; + + private final Map additionalProperties; + + private RegexOption(RegexOptionType type, boolean enabled, Map additionalProperties) { + this.type = type; + this.enabled = enabled; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the type of the regex option. Options are: + *
    + *
  • ignore-case: Ignores the case of the text being matched.
  • + *
  • whole-word: Matches whole words only.
  • + *
  • multi-line: Matches across multiple lines.
  • + *
+ */ + @JsonProperty("type") + public RegexOptionType getType() { + return type; + } + + /** + * @return This is whether to enable the option. + *

@default false

+ */ + @JsonProperty("enabled") + public boolean getEnabled() { + return enabled; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RegexOption && equalTo((RegexOption) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RegexOption other) { + return type.equals(other.type) && enabled == other.enabled; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.enabled); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TypeStage builder() { + return new Builder(); + } + + public interface TypeStage { + EnabledStage type(@NotNull RegexOptionType type); + + Builder from(RegexOption other); + } + + public interface EnabledStage { + _FinalStage enabled(boolean enabled); + } + + public interface _FinalStage { + RegexOption build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, EnabledStage, _FinalStage { + private RegexOptionType type; + + private boolean enabled; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RegexOption other) { + type(other.getType()); + enabled(other.getEnabled()); + return this; + } + + /** + *

This is the type of the regex option. Options are:

+ *
    + *
  • ignore-case: Ignores the case of the text being matched.
  • + *
  • whole-word: Matches whole words only.
  • + *
  • multi-line: Matches across multiple lines.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("type") + public EnabledStage type(@NotNull RegexOptionType type) { + this.type = Objects.requireNonNull(type, "type must not be null"); + return this; + } + + /** + *

This is whether to enable the option.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("enabled") + public _FinalStage enabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + @java.lang.Override + public RegexOption build() { + return new RegexOption(type, enabled, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/RegexOptionType.java b/src/main/java/com/vapi/api/types/RegexOptionType.java new file mode 100644 index 0000000..3853dfb --- /dev/null +++ b/src/main/java/com/vapi/api/types/RegexOptionType.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum RegexOptionType { + IGNORE_CASE("ignore-case"), + + WHOLE_WORD("whole-word"), + + MULTI_LINE("multi-line"); + + private final String value; + + RegexOptionType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/RegexReplacement.java b/src/main/java/com/vapi/api/types/RegexReplacement.java new file mode 100644 index 0000000..ba7b992 --- /dev/null +++ b/src/main/java/com/vapi/api/types/RegexReplacement.java @@ -0,0 +1,179 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RegexReplacement.Builder.class) +public final class RegexReplacement { + private final String regex; + + private final Optional> options; + + private final String value; + + private final Map additionalProperties; + + private RegexReplacement( + String regex, Optional> options, String value, Map additionalProperties) { + this.regex = regex; + this.options = options; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the regex pattern to replace. + */ + @JsonProperty("regex") + public String getRegex() { + return regex; + } + + /** + * @return These are the options for the regex replacement. Default all options are disabled. + *

@default []

+ */ + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + + /** + * @return This is the value that will replace the match. + */ + @JsonProperty("value") + public String getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RegexReplacement && equalTo((RegexReplacement) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RegexReplacement other) { + return regex.equals(other.regex) && options.equals(other.options) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.regex, this.options, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RegexStage builder() { + return new Builder(); + } + + public interface RegexStage { + ValueStage regex(@NotNull String regex); + + Builder from(RegexReplacement other); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + } + + public interface _FinalStage { + RegexReplacement build(); + + _FinalStage options(Optional> options); + + _FinalStage options(List options); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RegexStage, ValueStage, _FinalStage { + private String regex; + + private String value; + + private Optional> options = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RegexReplacement other) { + regex(other.getRegex()); + options(other.getOptions()); + value(other.getValue()); + return this; + } + + /** + *

This is the regex pattern to replace.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("regex") + public ValueStage regex(@NotNull String regex) { + this.regex = Objects.requireNonNull(regex, "regex must not be null"); + return this; + } + + /** + *

This is the value that will replace the match.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + /** + *

These are the options for the regex replacement. Default all options are disabled.

+ *

@default []

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + @java.lang.Override + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public _FinalStage options(Optional> options) { + this.options = options; + return this; + } + + @java.lang.Override + public RegexReplacement build() { + return new RegexReplacement(regex, options, value, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/RimeAiCredential.java b/src/main/java/com/vapi/api/types/RimeAiCredential.java new file mode 100644 index 0000000..c71d572 --- /dev/null +++ b/src/main/java/com/vapi/api/types/RimeAiCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RimeAiCredential.Builder.class) +public final class RimeAiCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private RimeAiCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "rime-ai"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RimeAiCredential && equalTo((RimeAiCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RimeAiCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(RimeAiCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + RimeAiCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RimeAiCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public RimeAiCredential build() { + return new RimeAiCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/RimeAiVoice.java b/src/main/java/com/vapi/api/types/RimeAiVoice.java new file mode 100644 index 0000000..8915104 --- /dev/null +++ b/src/main/java/com/vapi/api/types/RimeAiVoice.java @@ -0,0 +1,263 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RimeAiVoice.Builder.class) +public final class RimeAiVoice { + private final Optional fillerInjectionEnabled; + + private final RimeAiVoiceId voiceId; + + private final Optional model; + + private final Optional speed; + + private final Optional chunkPlan; + + private final Map additionalProperties; + + private RimeAiVoice( + Optional fillerInjectionEnabled, + RimeAiVoiceId voiceId, + Optional model, + Optional speed, + Optional chunkPlan, + Map additionalProperties) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + this.voiceId = voiceId; + this.model = model; + this.speed = speed; + this.chunkPlan = chunkPlan; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines whether fillers are injected into the model output before inputting it into the voice provider. + *

Default false because you can achieve better results with prompting the model.

+ */ + @JsonProperty("fillerInjectionEnabled") + public Optional getFillerInjectionEnabled() { + return fillerInjectionEnabled; + } + + /** + * @return This is the provider-specific ID that will be used. + */ + @JsonProperty("voiceId") + public RimeAiVoiceId getVoiceId() { + return voiceId; + } + + /** + * @return This is the model that will be used. Defaults to 'v1' when not specified. + */ + @JsonProperty("model") + public Optional getModel() { + return model; + } + + /** + * @return This is the speed multiplier that will be used. + */ + @JsonProperty("speed") + public Optional getSpeed() { + return speed; + } + + /** + * @return This is the plan for chunking the model output before it is sent to the voice provider. + */ + @JsonProperty("chunkPlan") + public Optional getChunkPlan() { + return chunkPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RimeAiVoice && equalTo((RimeAiVoice) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RimeAiVoice other) { + return fillerInjectionEnabled.equals(other.fillerInjectionEnabled) + && voiceId.equals(other.voiceId) + && model.equals(other.model) + && speed.equals(other.speed) + && chunkPlan.equals(other.chunkPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.fillerInjectionEnabled, this.voiceId, this.model, this.speed, this.chunkPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VoiceIdStage builder() { + return new Builder(); + } + + public interface VoiceIdStage { + _FinalStage voiceId(@NotNull RimeAiVoiceId voiceId); + + Builder from(RimeAiVoice other); + } + + public interface _FinalStage { + RimeAiVoice build(); + + _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled); + + _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled); + + _FinalStage model(Optional model); + + _FinalStage model(RimeAiVoiceModel model); + + _FinalStage speed(Optional speed); + + _FinalStage speed(Double speed); + + _FinalStage chunkPlan(Optional chunkPlan); + + _FinalStage chunkPlan(ChunkPlan chunkPlan); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VoiceIdStage, _FinalStage { + private RimeAiVoiceId voiceId; + + private Optional chunkPlan = Optional.empty(); + + private Optional speed = Optional.empty(); + + private Optional model = Optional.empty(); + + private Optional fillerInjectionEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RimeAiVoice other) { + fillerInjectionEnabled(other.getFillerInjectionEnabled()); + voiceId(other.getVoiceId()); + model(other.getModel()); + speed(other.getSpeed()); + chunkPlan(other.getChunkPlan()); + return this; + } + + /** + *

This is the provider-specific ID that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("voiceId") + public _FinalStage voiceId(@NotNull RimeAiVoiceId voiceId) { + this.voiceId = Objects.requireNonNull(voiceId, "voiceId must not be null"); + return this; + } + + /** + *

This is the plan for chunking the model output before it is sent to the voice provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage chunkPlan(ChunkPlan chunkPlan) { + this.chunkPlan = Optional.ofNullable(chunkPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "chunkPlan", nulls = Nulls.SKIP) + public _FinalStage chunkPlan(Optional chunkPlan) { + this.chunkPlan = chunkPlan; + return this; + } + + /** + *

This is the speed multiplier that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage speed(Double speed) { + this.speed = Optional.ofNullable(speed); + return this; + } + + @java.lang.Override + @JsonSetter(value = "speed", nulls = Nulls.SKIP) + public _FinalStage speed(Optional speed) { + this.speed = speed; + return this; + } + + /** + *

This is the model that will be used. Defaults to 'v1' when not specified.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage model(RimeAiVoiceModel model) { + this.model = Optional.ofNullable(model); + return this; + } + + @java.lang.Override + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public _FinalStage model(Optional model) { + this.model = model; + return this; + } + + /** + *

This determines whether fillers are injected into the model output before inputting it into the voice provider.

+ *

Default false because you can achieve better results with prompting the model.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fillerInjectionEnabled(Boolean fillerInjectionEnabled) { + this.fillerInjectionEnabled = Optional.ofNullable(fillerInjectionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fillerInjectionEnabled", nulls = Nulls.SKIP) + public _FinalStage fillerInjectionEnabled(Optional fillerInjectionEnabled) { + this.fillerInjectionEnabled = fillerInjectionEnabled; + return this; + } + + @java.lang.Override + public RimeAiVoice build() { + return new RimeAiVoice(fillerInjectionEnabled, voiceId, model, speed, chunkPlan, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/RimeAiVoiceId.java b/src/main/java/com/vapi/api/types/RimeAiVoiceId.java new file mode 100644 index 0000000..6b2adfe --- /dev/null +++ b/src/main/java/com/vapi/api/types/RimeAiVoiceId.java @@ -0,0 +1,94 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.vapi.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = RimeAiVoiceId.Deserializer.class) +public final class RimeAiVoiceId { + private final Object value; + + private final int type; + + private RimeAiVoiceId(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((RimeAiVoiceIdEnum) this.value); + } else if (this.type == 1) { + return visitor.visit((String) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RimeAiVoiceId && equalTo((RimeAiVoiceId) other); + } + + private boolean equalTo(RimeAiVoiceId other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static RimeAiVoiceId of(RimeAiVoiceIdEnum value) { + return new RimeAiVoiceId(value, 0); + } + + public static RimeAiVoiceId of(String value) { + return new RimeAiVoiceId(value, 1); + } + + public interface Visitor { + T visit(RimeAiVoiceIdEnum value); + + T visit(String value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(RimeAiVoiceId.class); + } + + @java.lang.Override + public RimeAiVoiceId deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, RimeAiVoiceIdEnum.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class)); + } catch (IllegalArgumentException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/vapi/api/types/RimeAiVoiceIdEnum.java b/src/main/java/com/vapi/api/types/RimeAiVoiceIdEnum.java new file mode 100644 index 0000000..9f82d78 --- /dev/null +++ b/src/main/java/com/vapi/api/types/RimeAiVoiceIdEnum.java @@ -0,0 +1,182 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum RimeAiVoiceIdEnum { + MARSH("marsh"), + + BAYOU("bayou"), + + CREEK("creek"), + + BROOK("brook"), + + FLOWER("flower"), + + SPORE("spore"), + + GLACIER("glacier"), + + GULCH("gulch"), + + ALPINE("alpine"), + + COVE("cove"), + + LAGOON("lagoon"), + + TUNDRA("tundra"), + + STEPPE("steppe"), + + MESA("mesa"), + + GROVE("grove"), + + RAINFOREST("rainforest"), + + MORAINE("moraine"), + + WILDFLOWER("wildflower"), + + PEAK("peak"), + + BOULDER("boulder"), + + ABBIE("abbie"), + + ALLISON("allison"), + + ALLY("ally"), + + ALONA("alona"), + + AMBER("amber"), + + ANA("ana"), + + ANTOINE("antoine"), + + ARMON("armon"), + + BRENDA("brenda"), + + BRITTANY("brittany"), + + CAROL("carol"), + + COLIN("colin"), + + COURTNEY("courtney"), + + ELENA("elena"), + + ELLIOT("elliot"), + + EVA("eva"), + + GEOFF("geoff"), + + GERALD("gerald"), + + HANK("hank"), + + HELEN("helen"), + + HERA("hera"), + + JEN("jen"), + + JOE("joe"), + + JOY("joy"), + + JUAN("juan"), + + KENDRA("kendra"), + + KENDRICK("kendrick"), + + KENNETH("kenneth"), + + KEVIN("kevin"), + + KRIS("kris"), + + LINDA("linda"), + + MADISON("madison"), + + MARGE("marge"), + + MARINA("marina"), + + MARISSA("marissa"), + + MARTA("marta"), + + MAYA("maya"), + + NICHOLAS("nicholas"), + + NYLES("nyles"), + + PHIL("phil"), + + REBA("reba"), + + REX("rex"), + + RICK("rick"), + + RITU("ritu"), + + ROB("rob"), + + RODNEY("rodney"), + + ROHAN("rohan"), + + ROSCO("rosco"), + + SAMANTHA("samantha"), + + SANDY("sandy"), + + SELENA("selena"), + + SETH("seth"), + + SHARON("sharon"), + + STAN("stan"), + + TAMRA("tamra"), + + TANYA("tanya"), + + TIBUR("tibur"), + + TJ("tj"), + + TYLER("tyler"), + + VIV("viv"), + + YADIRA("yadira"); + + private final String value; + + RimeAiVoiceIdEnum(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/RimeAiVoiceModel.java b/src/main/java/com/vapi/api/types/RimeAiVoiceModel.java new file mode 100644 index 0000000..7d1725b --- /dev/null +++ b/src/main/java/com/vapi/api/types/RimeAiVoiceModel.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum RimeAiVoiceModel { + V_1("v1"), + + MIST("mist"); + + private final String value; + + RimeAiVoiceModel(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/RuleBasedCondition.java b/src/main/java/com/vapi/api/types/RuleBasedCondition.java new file mode 100644 index 0000000..5dd1a2e --- /dev/null +++ b/src/main/java/com/vapi/api/types/RuleBasedCondition.java @@ -0,0 +1,281 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RuleBasedCondition.Builder.class) +public final class RuleBasedCondition { + private final RuleBasedConditionOperator operator; + + private final String leftSide; + + private final String rightSide; + + private final Map additionalProperties; + + private RuleBasedCondition( + RuleBasedConditionOperator operator, + String leftSide, + String rightSide, + Map additionalProperties) { + this.operator = operator; + this.leftSide = leftSide; + this.rightSide = rightSide; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the operator you want to use to compare the left side and right side. + *

The operation becomes (leftSide) operator (rightSide).

+ */ + @JsonProperty("operator") + public RuleBasedConditionOperator getOperator() { + return operator; + } + + /** + * @return This is the left side of the operation. + *

You can reference any variable in the context of the current block execution (step):

+ *
    + *
  • "{{output.your-property-name}}" for current step's output
  • + *
  • "{{input.your-property-name}}" for current step's input
  • + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • + *
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

Or, you can use a constant:

+ *
    + *
  • "1"
  • + *
  • "text"
  • + *
  • "true"
  • + *
  • "false"
  • + *
+ *

Or, you can mix and match with string interpolation:

+ *
    + *
  • "{{your-property-name}}-{{input.your-property-name-2}}-1"
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ */ + @JsonProperty("leftSide") + public String getLeftSide() { + return leftSide; + } + + /** + * @return This is the right side of the operation. + *

You can reference any variable in the context of the current block execution (step):

+ *
    + *
  • "{{output.your-property-name}}" for current step's output
  • + *
  • "{{input.your-property-name}}" for current step's input
  • + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • + *
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

Or, you can use a constant:

+ *
    + *
  • "1"
  • + *
  • "text"
  • + *
  • "true"
  • + *
  • "false"
  • + *
+ *

Or, you can mix and match with string interpolation:

+ *
    + *
  • "{{your-property-name}}-{{input.your-property-name-2}}-1"
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ */ + @JsonProperty("rightSide") + public String getRightSide() { + return rightSide; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RuleBasedCondition && equalTo((RuleBasedCondition) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RuleBasedCondition other) { + return operator.equals(other.operator) && leftSide.equals(other.leftSide) && rightSide.equals(other.rightSide); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.operator, this.leftSide, this.rightSide); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static OperatorStage builder() { + return new Builder(); + } + + public interface OperatorStage { + LeftSideStage operator(@NotNull RuleBasedConditionOperator operator); + + Builder from(RuleBasedCondition other); + } + + public interface LeftSideStage { + RightSideStage leftSide(@NotNull String leftSide); + } + + public interface RightSideStage { + _FinalStage rightSide(@NotNull String rightSide); + } + + public interface _FinalStage { + RuleBasedCondition build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements OperatorStage, LeftSideStage, RightSideStage, _FinalStage { + private RuleBasedConditionOperator operator; + + private String leftSide; + + private String rightSide; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RuleBasedCondition other) { + operator(other.getOperator()); + leftSide(other.getLeftSide()); + rightSide(other.getRightSide()); + return this; + } + + /** + *

This is the operator you want to use to compare the left side and right side.

+ *

The operation becomes (leftSide) operator (rightSide).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("operator") + public LeftSideStage operator(@NotNull RuleBasedConditionOperator operator) { + this.operator = Objects.requireNonNull(operator, "operator must not be null"); + return this; + } + + /** + *

This is the left side of the operation.

+ *

You can reference any variable in the context of the current block execution (step):

+ *
    + *
  • "{{output.your-property-name}}" for current step's output
  • + *
  • "{{input.your-property-name}}" for current step's input
  • + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • + *
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

Or, you can use a constant:

+ *
    + *
  • "1"
  • + *
  • "text"
  • + *
  • "true"
  • + *
  • "false"
  • + *
+ *

Or, you can mix and match with string interpolation:

+ *
    + *
  • "{{your-property-name}}-{{input.your-property-name-2}}-1"
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("leftSide") + public RightSideStage leftSide(@NotNull String leftSide) { + this.leftSide = Objects.requireNonNull(leftSide, "leftSide must not be null"); + return this; + } + + /** + *

This is the right side of the operation.

+ *

You can reference any variable in the context of the current block execution (step):

+ *
    + *
  • "{{output.your-property-name}}" for current step's output
  • + *
  • "{{input.your-property-name}}" for current step's input
  • + *
  • "{{your-step-name.output.your-property-name}}" for another step's output (in the same workflow; read caveat #1)
  • + *
  • "{{your-step-name.input.your-property-name}}" for another step's input (in the same workflow; read caveat #1)
  • + *
  • "{{your-block-name.output.your-property-name}}" for another block's output (in the same workflow; read caveat #2)
  • + *
  • "{{your-block-name.input.your-property-name}}" for another block's input (in the same workflow; read caveat #2)
  • + *
  • "{{workflow.input.your-property-name}}" for the current workflow's input
  • + *
  • "{{global.your-property-name}}" for the global context
  • + *
+ *

Or, you can use a constant:

+ *
    + *
  • "1"
  • + *
  • "text"
  • + *
  • "true"
  • + *
  • "false"
  • + *
+ *

Or, you can mix and match with string interpolation:

+ *
    + *
  • "{{your-property-name}}-{{input.your-property-name-2}}-1"
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.input/output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.input/output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("rightSide") + public _FinalStage rightSide(@NotNull String rightSide) { + this.rightSide = Objects.requireNonNull(rightSide, "rightSide must not be null"); + return this; + } + + @java.lang.Override + public RuleBasedCondition build() { + return new RuleBasedCondition(operator, leftSide, rightSide, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/RuleBasedConditionOperator.java b/src/main/java/com/vapi/api/types/RuleBasedConditionOperator.java new file mode 100644 index 0000000..1451730 --- /dev/null +++ b/src/main/java/com/vapi/api/types/RuleBasedConditionOperator.java @@ -0,0 +1,32 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum RuleBasedConditionOperator { + EQ("eq"), + + NEQ("neq"), + + GT("gt"), + + GTE("gte"), + + LT("lt"), + + LTE("lte"); + + private final String value; + + RuleBasedConditionOperator(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/RunpodCredential.java b/src/main/java/com/vapi/api/types/RunpodCredential.java new file mode 100644 index 0000000..f925fe6 --- /dev/null +++ b/src/main/java/com/vapi/api/types/RunpodCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RunpodCredential.Builder.class) +public final class RunpodCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private RunpodCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "runpod"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RunpodCredential && equalTo((RunpodCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RunpodCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(RunpodCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + RunpodCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RunpodCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public RunpodCredential build() { + return new RunpodCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/S3Credential.java b/src/main/java/com/vapi/api/types/S3Credential.java new file mode 100644 index 0000000..e8ae8b1 --- /dev/null +++ b/src/main/java/com/vapi/api/types/S3Credential.java @@ -0,0 +1,397 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = S3Credential.Builder.class) +public final class S3Credential { + private final String awsAccessKeyId; + + private final String awsSecretAccessKey; + + private final String region; + + private final String s3BucketName; + + private final String s3PathPrefix; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private S3Credential( + String awsAccessKeyId, + String awsSecretAccessKey, + String region, + String s3BucketName, + String s3PathPrefix, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.awsAccessKeyId = awsAccessKeyId; + this.awsSecretAccessKey = awsSecretAccessKey; + this.region = region; + this.s3BucketName = s3BucketName; + this.s3PathPrefix = s3PathPrefix; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return Credential provider. Only allowed value is s3 + */ + @JsonProperty("provider") + public String getProvider() { + return "s3"; + } + + /** + * @return AWS access key ID. + */ + @JsonProperty("awsAccessKeyId") + public String getAwsAccessKeyId() { + return awsAccessKeyId; + } + + /** + * @return AWS access key secret. This is not returned in the API. + */ + @JsonProperty("awsSecretAccessKey") + public String getAwsSecretAccessKey() { + return awsSecretAccessKey; + } + + /** + * @return AWS region in which the S3 bucket is located. + */ + @JsonProperty("region") + public String getRegion() { + return region; + } + + /** + * @return AWS S3 bucket name. + */ + @JsonProperty("s3BucketName") + public String getS3BucketName() { + return s3BucketName; + } + + /** + * @return The path prefix for the uploaded recording. Ex. "recordings/" + */ + @JsonProperty("s3PathPrefix") + public String getS3PathPrefix() { + return s3PathPrefix; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof S3Credential && equalTo((S3Credential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(S3Credential other) { + return awsAccessKeyId.equals(other.awsAccessKeyId) + && awsSecretAccessKey.equals(other.awsSecretAccessKey) + && region.equals(other.region) + && s3BucketName.equals(other.s3BucketName) + && s3PathPrefix.equals(other.s3PathPrefix) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.awsAccessKeyId, + this.awsSecretAccessKey, + this.region, + this.s3BucketName, + this.s3PathPrefix, + this.id, + this.orgId, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AwsAccessKeyIdStage builder() { + return new Builder(); + } + + public interface AwsAccessKeyIdStage { + AwsSecretAccessKeyStage awsAccessKeyId(@NotNull String awsAccessKeyId); + + Builder from(S3Credential other); + } + + public interface AwsSecretAccessKeyStage { + RegionStage awsSecretAccessKey(@NotNull String awsSecretAccessKey); + } + + public interface RegionStage { + S3BucketNameStage region(@NotNull String region); + } + + public interface S3BucketNameStage { + S3PathPrefixStage s3BucketName(@NotNull String s3BucketName); + } + + public interface S3PathPrefixStage { + IdStage s3PathPrefix(@NotNull String s3PathPrefix); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + S3Credential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AwsAccessKeyIdStage, + AwsSecretAccessKeyStage, + RegionStage, + S3BucketNameStage, + S3PathPrefixStage, + IdStage, + OrgIdStage, + CreatedAtStage, + UpdatedAtStage, + _FinalStage { + private String awsAccessKeyId; + + private String awsSecretAccessKey; + + private String region; + + private String s3BucketName; + + private String s3PathPrefix; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(S3Credential other) { + awsAccessKeyId(other.getAwsAccessKeyId()); + awsSecretAccessKey(other.getAwsSecretAccessKey()); + region(other.getRegion()); + s3BucketName(other.getS3BucketName()); + s3PathPrefix(other.getS3PathPrefix()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

AWS access key ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("awsAccessKeyId") + public AwsSecretAccessKeyStage awsAccessKeyId(@NotNull String awsAccessKeyId) { + this.awsAccessKeyId = Objects.requireNonNull(awsAccessKeyId, "awsAccessKeyId must not be null"); + return this; + } + + /** + *

AWS access key secret. This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("awsSecretAccessKey") + public RegionStage awsSecretAccessKey(@NotNull String awsSecretAccessKey) { + this.awsSecretAccessKey = Objects.requireNonNull(awsSecretAccessKey, "awsSecretAccessKey must not be null"); + return this; + } + + /** + *

AWS region in which the S3 bucket is located.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("region") + public S3BucketNameStage region(@NotNull String region) { + this.region = Objects.requireNonNull(region, "region must not be null"); + return this; + } + + /** + *

AWS S3 bucket name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("s3BucketName") + public S3PathPrefixStage s3BucketName(@NotNull String s3BucketName) { + this.s3BucketName = Objects.requireNonNull(s3BucketName, "s3BucketName must not be null"); + return this; + } + + /** + *

The path prefix for the uploaded recording. Ex. "recordings/"

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("s3PathPrefix") + public IdStage s3PathPrefix(@NotNull String s3PathPrefix) { + this.s3PathPrefix = Objects.requireNonNull(s3PathPrefix, "s3PathPrefix must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public S3Credential build() { + return new S3Credential( + awsAccessKeyId, + awsSecretAccessKey, + region, + s3BucketName, + s3PathPrefix, + id, + orgId, + createdAt, + updatedAt, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/SbcConfiguration.java b/src/main/java/com/vapi/api/types/SbcConfiguration.java new file mode 100644 index 0000000..1c44a01 --- /dev/null +++ b/src/main/java/com/vapi/api/types/SbcConfiguration.java @@ -0,0 +1,59 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SbcConfiguration.Builder.class) +public final class SbcConfiguration { + private final Map additionalProperties; + + private SbcConfiguration(Map additionalProperties) { + this.additionalProperties = additionalProperties; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SbcConfiguration; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SbcConfiguration other) { + return this; + } + + public SbcConfiguration build() { + return new SbcConfiguration(additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/Server.java b/src/main/java/com/vapi/api/types/Server.java new file mode 100644 index 0000000..7997294 --- /dev/null +++ b/src/main/java/com/vapi/api/types/Server.java @@ -0,0 +1,189 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Server.Builder.class) +public final class Server { + private final Optional timeoutSeconds; + + private final String url; + + private final Optional secret; + + private final Map additionalProperties; + + private Server( + Optional timeoutSeconds, + String url, + Optional secret, + Map additionalProperties) { + this.timeoutSeconds = timeoutSeconds; + this.url = url; + this.secret = secret; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the timeout in seconds for the request to your server. Defaults to 20 seconds. + *

@default 20

+ */ + @JsonProperty("timeoutSeconds") + public Optional getTimeoutSeconds() { + return timeoutSeconds; + } + + /** + * @return API endpoint to send requests to. + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + /** + * @return This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret. + *

Same precedence logic as server.

+ */ + @JsonProperty("secret") + public Optional getSecret() { + return secret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Server && equalTo((Server) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Server other) { + return timeoutSeconds.equals(other.timeoutSeconds) && url.equals(other.url) && secret.equals(other.secret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.timeoutSeconds, this.url, this.secret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + _FinalStage url(@NotNull String url); + + Builder from(Server other); + } + + public interface _FinalStage { + Server build(); + + _FinalStage timeoutSeconds(Optional timeoutSeconds); + + _FinalStage timeoutSeconds(Double timeoutSeconds); + + _FinalStage secret(Optional secret); + + _FinalStage secret(String secret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UrlStage, _FinalStage { + private String url; + + private Optional secret = Optional.empty(); + + private Optional timeoutSeconds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Server other) { + timeoutSeconds(other.getTimeoutSeconds()); + url(other.getUrl()); + secret(other.getSecret()); + return this; + } + + /** + *

API endpoint to send requests to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); + return this; + } + + /** + *

This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret.

+ *

Same precedence logic as server.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage secret(String secret) { + this.secret = Optional.ofNullable(secret); + return this; + } + + @java.lang.Override + @JsonSetter(value = "secret", nulls = Nulls.SKIP) + public _FinalStage secret(Optional secret) { + this.secret = secret; + return this; + } + + /** + *

This is the timeout in seconds for the request to your server. Defaults to 20 seconds.

+ *

@default 20

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timeoutSeconds(Double timeoutSeconds) { + this.timeoutSeconds = Optional.ofNullable(timeoutSeconds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "timeoutSeconds", nulls = Nulls.SKIP) + public _FinalStage timeoutSeconds(Optional timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + + @java.lang.Override + public Server build() { + return new Server(timeoutSeconds, url, secret, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessage.java b/src/main/java/com/vapi/api/types/ServerMessage.java new file mode 100644 index 0000000..ea8f428 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessage.java @@ -0,0 +1,123 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessage.Builder.class) +public final class ServerMessage { + private final ServerMessageMessage message; + + private final Map additionalProperties; + + private ServerMessage(ServerMessageMessage message, Map additionalProperties) { + this.message = message; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are all the messages that can be sent to your server before, after and during the call. Configure the messages you'd like to receive in assistant.serverMessages. + *

The server where the message is sent is determined by the following precedence order:

+ *
    + *
  1. tool.server.url (if configured, and only for "tool-calls" message)
  2. + *
  3. assistant.serverUrl (if configure)
  4. + *
  5. phoneNumber.serverUrl (if configured)
  6. + *
  7. org.serverUrl (if configured)
  8. + *
+ */ + @JsonProperty("message") + public ServerMessageMessage getMessage() { + return message; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessage && equalTo((ServerMessage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessage other) { + return message.equals(other.message); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.message); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + _FinalStage message(@NotNull ServerMessageMessage message); + + Builder from(ServerMessage other); + } + + public interface _FinalStage { + ServerMessage build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageStage, _FinalStage { + private ServerMessageMessage message; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ServerMessage other) { + message(other.getMessage()); + return this; + } + + /** + *

These are all the messages that can be sent to your server before, after and during the call. Configure the messages you'd like to receive in assistant.serverMessages.

+ *

The server where the message is sent is determined by the following precedence order:

+ *
    + *
  1. tool.server.url (if configured, and only for "tool-calls" message)
  2. + *
  3. assistant.serverUrl (if configure)
  4. + *
  5. phoneNumber.serverUrl (if configured)
  6. + *
  7. org.serverUrl (if configured)
  8. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message") + public _FinalStage message(@NotNull ServerMessageMessage message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + @java.lang.Override + public ServerMessage build() { + return new ServerMessage(message, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageAssistantRequest.java b/src/main/java/com/vapi/api/types/ServerMessageAssistantRequest.java new file mode 100644 index 0000000..34a4cf7 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageAssistantRequest.java @@ -0,0 +1,258 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageAssistantRequest.Builder.class) +public final class ServerMessageAssistantRequest { + private final Optional phoneNumber; + + private final Optional timestamp; + + private final Optional artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final Map additionalProperties; + + private ServerMessageAssistantRequest( + Optional phoneNumber, + Optional timestamp, + Optional artifact, + Optional assistant, + Optional customer, + Optional call, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return This is a live version of the call.artifact. + *

This matches what is stored on call.artifact after the call.

+ */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageAssistantRequest && equalTo((ServerMessageAssistantRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageAssistantRequest other) { + return phoneNumber.equals(other.phoneNumber) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.phoneNumber, this.timestamp, this.artifact, this.assistant, this.customer, this.call); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional phoneNumber = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional call = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ServerMessageAssistantRequest other) { + phoneNumber(other.getPhoneNumber()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + return this; + } + + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public Builder phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + public Builder phoneNumber(ServerMessageAssistantRequestPhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public Builder timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + public Builder timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public Builder artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + public Builder artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public Builder assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + public Builder assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public Builder customer(Optional customer) { + this.customer = customer; + return this; + } + + public Builder customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public Builder call(Optional call) { + this.call = call; + return this; + } + + public Builder call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + public ServerMessageAssistantRequest build() { + return new ServerMessageAssistantRequest( + phoneNumber, timestamp, artifact, assistant, customer, call, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageAssistantRequestPhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessageAssistantRequestPhoneNumber.java new file mode 100644 index 0000000..b61524f --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageAssistantRequestPhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageAssistantRequestPhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageAssistantRequestPhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageAssistantRequestPhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessageAssistantRequestPhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessageAssistantRequestPhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessageAssistantRequestPhoneNumber(new TwilioValue(value)); + } + + public static ServerMessageAssistantRequestPhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessageAssistantRequestPhoneNumber(new VonageValue(value)); + } + + public static ServerMessageAssistantRequestPhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessageAssistantRequestPhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageAssistantRequestPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageAssistantRequestPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageAssistantRequestPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageAssistantRequestPhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageAssistantRequestPhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageConversationUpdate.java b/src/main/java/com/vapi/api/types/ServerMessageConversationUpdate.java new file mode 100644 index 0000000..83f4b67 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageConversationUpdate.java @@ -0,0 +1,336 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageConversationUpdate.Builder.class) +public final class ServerMessageConversationUpdate { + private final Optional phoneNumber; + + private final Optional> messages; + + private final List messagesOpenAiFormatted; + + private final Optional timestamp; + + private final Optional artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final Map additionalProperties; + + private ServerMessageConversationUpdate( + Optional phoneNumber, + Optional> messages, + List messagesOpenAiFormatted, + Optional timestamp, + Optional artifact, + Optional assistant, + Optional customer, + Optional call, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.messages = messages; + this.messagesOpenAiFormatted = messagesOpenAiFormatted; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the most up-to-date conversation history at the time the message is sent. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the most up-to-date conversation history at the time the message is sent, formatted for OpenAI. + */ + @JsonProperty("messagesOpenAIFormatted") + public List getMessagesOpenAiFormatted() { + return messagesOpenAiFormatted; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return This is a live version of the call.artifact. + *

This matches what is stored on call.artifact after the call.

+ */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageConversationUpdate && equalTo((ServerMessageConversationUpdate) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageConversationUpdate other) { + return phoneNumber.equals(other.phoneNumber) + && messages.equals(other.messages) + && messagesOpenAiFormatted.equals(other.messagesOpenAiFormatted) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.phoneNumber, + this.messages, + this.messagesOpenAiFormatted, + this.timestamp, + this.artifact, + this.assistant, + this.customer, + this.call); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional phoneNumber = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private List messagesOpenAiFormatted = new ArrayList<>(); + + private Optional timestamp = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional call = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ServerMessageConversationUpdate other) { + phoneNumber(other.getPhoneNumber()); + messages(other.getMessages()); + messagesOpenAiFormatted(other.getMessagesOpenAiFormatted()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + return this; + } + + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public Builder phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + public Builder phoneNumber(ServerMessageConversationUpdatePhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "messagesOpenAIFormatted", nulls = Nulls.SKIP) + public Builder messagesOpenAiFormatted(List messagesOpenAiFormatted) { + this.messagesOpenAiFormatted.clear(); + this.messagesOpenAiFormatted.addAll(messagesOpenAiFormatted); + return this; + } + + public Builder addMessagesOpenAiFormatted(OpenAiMessage messagesOpenAiFormatted) { + this.messagesOpenAiFormatted.add(messagesOpenAiFormatted); + return this; + } + + public Builder addAllMessagesOpenAiFormatted(List messagesOpenAiFormatted) { + this.messagesOpenAiFormatted.addAll(messagesOpenAiFormatted); + return this; + } + + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public Builder timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + public Builder timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public Builder artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + public Builder artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public Builder assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + public Builder assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public Builder customer(Optional customer) { + this.customer = customer; + return this; + } + + public Builder customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public Builder call(Optional call) { + this.call = call; + return this; + } + + public Builder call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + public ServerMessageConversationUpdate build() { + return new ServerMessageConversationUpdate( + phoneNumber, + messages, + messagesOpenAiFormatted, + timestamp, + artifact, + assistant, + customer, + call, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageConversationUpdateMessagesItem.java b/src/main/java/com/vapi/api/types/ServerMessageConversationUpdateMessagesItem.java new file mode 100644 index 0000000..7a908ad --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageConversationUpdateMessagesItem.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.vapi.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = ServerMessageConversationUpdateMessagesItem.Deserializer.class) +public final class ServerMessageConversationUpdateMessagesItem { + private final Object value; + + private final int type; + + private ServerMessageConversationUpdateMessagesItem(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((UserMessage) this.value); + } else if (this.type == 1) { + return visitor.visit((SystemMessage) this.value); + } else if (this.type == 2) { + return visitor.visit((BotMessage) this.value); + } else if (this.type == 3) { + return visitor.visit((ToolCallMessage) this.value); + } else if (this.type == 4) { + return visitor.visit((ToolCallResultMessage) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageConversationUpdateMessagesItem + && equalTo((ServerMessageConversationUpdateMessagesItem) other); + } + + private boolean equalTo(ServerMessageConversationUpdateMessagesItem other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static ServerMessageConversationUpdateMessagesItem of(UserMessage value) { + return new ServerMessageConversationUpdateMessagesItem(value, 0); + } + + public static ServerMessageConversationUpdateMessagesItem of(SystemMessage value) { + return new ServerMessageConversationUpdateMessagesItem(value, 1); + } + + public static ServerMessageConversationUpdateMessagesItem of(BotMessage value) { + return new ServerMessageConversationUpdateMessagesItem(value, 2); + } + + public static ServerMessageConversationUpdateMessagesItem of(ToolCallMessage value) { + return new ServerMessageConversationUpdateMessagesItem(value, 3); + } + + public static ServerMessageConversationUpdateMessagesItem of(ToolCallResultMessage value) { + return new ServerMessageConversationUpdateMessagesItem(value, 4); + } + + public interface Visitor { + T visit(UserMessage value); + + T visit(SystemMessage value); + + T visit(BotMessage value); + + T visit(ToolCallMessage value); + + T visit(ToolCallResultMessage value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(ServerMessageConversationUpdateMessagesItem.class); + } + + @java.lang.Override + public ServerMessageConversationUpdateMessagesItem deserialize(JsonParser p, DeserializationContext ctxt) + throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, UserMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, SystemMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, BotMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ToolCallMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ToolCallResultMessage.class)); + } catch (IllegalArgumentException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageConversationUpdatePhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessageConversationUpdatePhoneNumber.java new file mode 100644 index 0000000..24817d8 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageConversationUpdatePhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageConversationUpdatePhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageConversationUpdatePhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageConversationUpdatePhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessageConversationUpdatePhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessageConversationUpdatePhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessageConversationUpdatePhoneNumber(new TwilioValue(value)); + } + + public static ServerMessageConversationUpdatePhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessageConversationUpdatePhoneNumber(new VonageValue(value)); + } + + public static ServerMessageConversationUpdatePhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessageConversationUpdatePhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageConversationUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageConversationUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageConversationUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageConversationUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageConversationUpdatePhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageEndOfCallReport.java b/src/main/java/com/vapi/api/types/ServerMessageEndOfCallReport.java new file mode 100644 index 0000000..5f643a4 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageEndOfCallReport.java @@ -0,0 +1,577 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageEndOfCallReport.Builder.class) +public final class ServerMessageEndOfCallReport { + private final Optional phoneNumber; + + private final ServerMessageEndOfCallReportEndedReason endedReason; + + private final Optional cost; + + private final Optional> costs; + + private final Optional timestamp; + + private final Artifact artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final Analysis analysis; + + private final Optional startedAt; + + private final Optional endedAt; + + private final Map additionalProperties; + + private ServerMessageEndOfCallReport( + Optional phoneNumber, + ServerMessageEndOfCallReportEndedReason endedReason, + Optional cost, + Optional> costs, + Optional timestamp, + Artifact artifact, + Optional assistant, + Optional customer, + Optional call, + Analysis analysis, + Optional startedAt, + Optional endedAt, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.endedReason = endedReason; + this.cost = cost; + this.costs = costs; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.analysis = analysis; + this.startedAt = startedAt; + this.endedAt = endedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the reason the call ended. This can also be found at call.endedReason on GET /call/:id. + */ + @JsonProperty("endedReason") + public ServerMessageEndOfCallReportEndedReason getEndedReason() { + return endedReason; + } + + /** + * @return This is the cost of the call in USD. This can also be found at call.cost on GET /call/:id. + */ + @JsonProperty("cost") + public Optional getCost() { + return cost; + } + + /** + * @return These are the costs of individual components of the call in USD. This can also be found at call.costs on GET /call/:id. + */ + @JsonProperty("costs") + public Optional> getCosts() { + return costs; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return These are the artifacts from the call. This can also be found at call.artifact on GET /call/:id. + */ + @JsonProperty("artifact") + public Artifact getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + /** + * @return This is the analysis of the call. This can also be found at call.analysis on GET /call/:id. + */ + @JsonProperty("analysis") + public Analysis getAnalysis() { + return analysis; + } + + /** + * @return This is the ISO 8601 date-time string of when the call started. This can also be found at call.startedAt on GET /call/:id. + */ + @JsonProperty("startedAt") + public Optional getStartedAt() { + return startedAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the call ended. This can also be found at call.endedAt on GET /call/:id. + */ + @JsonProperty("endedAt") + public Optional getEndedAt() { + return endedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageEndOfCallReport && equalTo((ServerMessageEndOfCallReport) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageEndOfCallReport other) { + return phoneNumber.equals(other.phoneNumber) + && endedReason.equals(other.endedReason) + && cost.equals(other.cost) + && costs.equals(other.costs) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call) + && analysis.equals(other.analysis) + && startedAt.equals(other.startedAt) + && endedAt.equals(other.endedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.phoneNumber, + this.endedReason, + this.cost, + this.costs, + this.timestamp, + this.artifact, + this.assistant, + this.customer, + this.call, + this.analysis, + this.startedAt, + this.endedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static EndedReasonStage builder() { + return new Builder(); + } + + public interface EndedReasonStage { + ArtifactStage endedReason(@NotNull ServerMessageEndOfCallReportEndedReason endedReason); + + Builder from(ServerMessageEndOfCallReport other); + } + + public interface ArtifactStage { + AnalysisStage artifact(@NotNull Artifact artifact); + } + + public interface AnalysisStage { + _FinalStage analysis(@NotNull Analysis analysis); + } + + public interface _FinalStage { + ServerMessageEndOfCallReport build(); + + _FinalStage phoneNumber(Optional phoneNumber); + + _FinalStage phoneNumber(ServerMessageEndOfCallReportPhoneNumber phoneNumber); + + _FinalStage cost(Optional cost); + + _FinalStage cost(Double cost); + + _FinalStage costs(Optional> costs); + + _FinalStage costs(List costs); + + _FinalStage timestamp(Optional timestamp); + + _FinalStage timestamp(String timestamp); + + _FinalStage assistant(Optional assistant); + + _FinalStage assistant(CreateAssistantDto assistant); + + _FinalStage customer(Optional customer); + + _FinalStage customer(CreateCustomerDto customer); + + _FinalStage call(Optional call); + + _FinalStage call(Call call); + + _FinalStage startedAt(Optional startedAt); + + _FinalStage startedAt(OffsetDateTime startedAt); + + _FinalStage endedAt(Optional endedAt); + + _FinalStage endedAt(OffsetDateTime endedAt); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements EndedReasonStage, ArtifactStage, AnalysisStage, _FinalStage { + private ServerMessageEndOfCallReportEndedReason endedReason; + + private Artifact artifact; + + private Analysis analysis; + + private Optional endedAt = Optional.empty(); + + private Optional startedAt = Optional.empty(); + + private Optional call = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Optional> costs = Optional.empty(); + + private Optional cost = Optional.empty(); + + private Optional phoneNumber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ServerMessageEndOfCallReport other) { + phoneNumber(other.getPhoneNumber()); + endedReason(other.getEndedReason()); + cost(other.getCost()); + costs(other.getCosts()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + analysis(other.getAnalysis()); + startedAt(other.getStartedAt()); + endedAt(other.getEndedAt()); + return this; + } + + /** + *

This is the reason the call ended. This can also be found at call.endedReason on GET /call/:id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("endedReason") + public ArtifactStage endedReason(@NotNull ServerMessageEndOfCallReportEndedReason endedReason) { + this.endedReason = Objects.requireNonNull(endedReason, "endedReason must not be null"); + return this; + } + + /** + *

These are the artifacts from the call. This can also be found at call.artifact on GET /call/:id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("artifact") + public AnalysisStage artifact(@NotNull Artifact artifact) { + this.artifact = Objects.requireNonNull(artifact, "artifact must not be null"); + return this; + } + + /** + *

This is the analysis of the call. This can also be found at call.analysis on GET /call/:id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("analysis") + public _FinalStage analysis(@NotNull Analysis analysis) { + this.analysis = Objects.requireNonNull(analysis, "analysis must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the call ended. This can also be found at call.endedAt on GET /call/:id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endedAt(OffsetDateTime endedAt) { + this.endedAt = Optional.ofNullable(endedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "endedAt", nulls = Nulls.SKIP) + public _FinalStage endedAt(Optional endedAt) { + this.endedAt = endedAt; + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the call started. This can also be found at call.startedAt on GET /call/:id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage startedAt(OffsetDateTime startedAt) { + this.startedAt = Optional.ofNullable(startedAt); + return this; + } + + @java.lang.Override + @JsonSetter(value = "startedAt", nulls = Nulls.SKIP) + public _FinalStage startedAt(Optional startedAt) { + this.startedAt = startedAt; + return this; + } + + /** + *

This is the call object.

+ *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + @java.lang.Override + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public _FinalStage call(Optional call) { + this.call = call; + return this; + } + + /** + *

This is the customer associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @java.lang.Override + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public _FinalStage customer(Optional customer) { + this.customer = customer; + return this; + } + + /** + *

This is the assistant that is currently active. This is provided for convenience.

+ *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public _FinalStage assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + /** + *

This is the ISO-8601 formatted timestamp of when the message was sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @java.lang.Override + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public _FinalStage timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + *

These are the costs of individual components of the call in USD. This can also be found at call.costs on GET /call/:id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage costs(List costs) { + this.costs = Optional.ofNullable(costs); + return this; + } + + @java.lang.Override + @JsonSetter(value = "costs", nulls = Nulls.SKIP) + public _FinalStage costs(Optional> costs) { + this.costs = costs; + return this; + } + + /** + *

This is the cost of the call in USD. This can also be found at call.cost on GET /call/:id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage cost(Double cost) { + this.cost = Optional.ofNullable(cost); + return this; + } + + @java.lang.Override + @JsonSetter(value = "cost", nulls = Nulls.SKIP) + public _FinalStage cost(Optional cost) { + this.cost = cost; + return this; + } + + /** + *

This is the phone number associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneNumber(ServerMessageEndOfCallReportPhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public _FinalStage phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + @java.lang.Override + public ServerMessageEndOfCallReport build() { + return new ServerMessageEndOfCallReport( + phoneNumber, + endedReason, + cost, + costs, + timestamp, + artifact, + assistant, + customer, + call, + analysis, + startedAt, + endedAt, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageEndOfCallReportCostsItem.java b/src/main/java/com/vapi/api/types/ServerMessageEndOfCallReportCostsItem.java new file mode 100644 index 0000000..1b0d674 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageEndOfCallReportCostsItem.java @@ -0,0 +1,427 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageEndOfCallReportCostsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageEndOfCallReportCostsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageEndOfCallReportCostsItem transport(TransportCost value) { + return new ServerMessageEndOfCallReportCostsItem(new TransportValue(value)); + } + + public static ServerMessageEndOfCallReportCostsItem transcriber(TranscriberCost value) { + return new ServerMessageEndOfCallReportCostsItem(new TranscriberValue(value)); + } + + public static ServerMessageEndOfCallReportCostsItem model(ModelCost value) { + return new ServerMessageEndOfCallReportCostsItem(new ModelValue(value)); + } + + public static ServerMessageEndOfCallReportCostsItem voice(VoiceCost value) { + return new ServerMessageEndOfCallReportCostsItem(new VoiceValue(value)); + } + + public static ServerMessageEndOfCallReportCostsItem vapi(VapiCost value) { + return new ServerMessageEndOfCallReportCostsItem(new VapiValue(value)); + } + + public static ServerMessageEndOfCallReportCostsItem analysis(AnalysisCost value) { + return new ServerMessageEndOfCallReportCostsItem(new AnalysisValue(value)); + } + + public boolean isTransport() { + return value instanceof TransportValue; + } + + public boolean isTranscriber() { + return value instanceof TranscriberValue; + } + + public boolean isModel() { + return value instanceof ModelValue; + } + + public boolean isVoice() { + return value instanceof VoiceValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean isAnalysis() { + return value instanceof AnalysisValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getTransport() { + if (isTransport()) { + return Optional.of(((TransportValue) value).value); + } + return Optional.empty(); + } + + public Optional getTranscriber() { + if (isTranscriber()) { + return Optional.of(((TranscriberValue) value).value); + } + return Optional.empty(); + } + + public Optional getModel() { + if (isModel()) { + return Optional.of(((ModelValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoice() { + if (isVoice()) { + return Optional.of(((VoiceValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional getAnalysis() { + if (isAnalysis()) { + return Optional.of(((AnalysisValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitTransport(TransportCost transport); + + T visitTranscriber(TranscriberCost transcriber); + + T visitModel(ModelCost model); + + T visitVoice(VoiceCost voice); + + T visitVapi(VapiCost vapi); + + T visitAnalysis(AnalysisCost analysis); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(TransportValue.class), + @JsonSubTypes.Type(TranscriberValue.class), + @JsonSubTypes.Type(ModelValue.class), + @JsonSubTypes.Type(VoiceValue.class), + @JsonSubTypes.Type(VapiValue.class), + @JsonSubTypes.Type(AnalysisValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("transport") + private static final class TransportValue implements Value { + @JsonUnwrapped + private TransportCost value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransportValue() {} + + private TransportValue(TransportCost value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransport(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransportValue && equalTo((TransportValue) other); + } + + private boolean equalTo(TransportValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageEndOfCallReportCostsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transcriber") + private static final class TranscriberValue implements Value { + @JsonUnwrapped + private TranscriberCost value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TranscriberValue() {} + + private TranscriberValue(TranscriberCost value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTranscriber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TranscriberValue && equalTo((TranscriberValue) other); + } + + private boolean equalTo(TranscriberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageEndOfCallReportCostsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("model") + private static final class ModelValue implements Value { + @JsonUnwrapped + private ModelCost value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ModelValue() {} + + private ModelValue(ModelCost value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitModel(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ModelValue && equalTo((ModelValue) other); + } + + private boolean equalTo(ModelValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageEndOfCallReportCostsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voice") + private static final class VoiceValue implements Value { + @JsonUnwrapped + private VoiceCost value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoiceValue() {} + + private VoiceValue(VoiceCost value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoice(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoiceValue && equalTo((VoiceValue) other); + } + + private boolean equalTo(VoiceValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageEndOfCallReportCostsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private VapiCost value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(VapiCost value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageEndOfCallReportCostsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("analysis") + private static final class AnalysisValue implements Value { + @JsonUnwrapped + private AnalysisCost value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AnalysisValue() {} + + private AnalysisValue(AnalysisCost value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAnalysis(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AnalysisValue && equalTo((AnalysisValue) other); + } + + private boolean equalTo(AnalysisValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageEndOfCallReportCostsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageEndOfCallReportCostsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageEndOfCallReportEndedReason.java b/src/main/java/com/vapi/api/types/ServerMessageEndOfCallReportEndedReason.java new file mode 100644 index 0000000..0c226b3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageEndOfCallReportEndedReason.java @@ -0,0 +1,376 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ServerMessageEndOfCallReportEndedReason { + ASSISTANT_ERROR("assistant-error"), + + ASSISTANT_NOT_FOUND("assistant-not-found"), + + DB_ERROR("db-error"), + + NO_SERVER_AVAILABLE("no-server-available"), + + LICENSE_CHECK_FAILED("license-check-failed"), + + PIPELINE_ERROR_OPENAI_LLM_FAILED("pipeline-error-openai-llm-failed"), + + PIPELINE_ERROR_AZURE_OPENAI_LLM_FAILED("pipeline-error-azure-openai-llm-failed"), + + PIPELINE_ERROR_GROQ_LLM_FAILED("pipeline-error-groq-llm-failed"), + + PIPELINE_ERROR_ANTHROPIC_LLM_FAILED("pipeline-error-anthropic-llm-failed"), + + PIPELINE_ERROR_VAPI_LLM_FAILED("pipeline-error-vapi-llm-failed"), + + PIPELINE_ERROR_VAPI_400_BAD_REQUEST_VALIDATION_FAILED("pipeline-error-vapi-400-bad-request-validation-failed"), + + PIPELINE_ERROR_VAPI_401_UNAUTHORIZED("pipeline-error-vapi-401-unauthorized"), + + PIPELINE_ERROR_VAPI_403_MODEL_ACCESS_DENIED("pipeline-error-vapi-403-model-access-denied"), + + PIPELINE_ERROR_VAPI_429_EXCEEDED_QUOTA("pipeline-error-vapi-429-exceeded-quota"), + + PIPELINE_ERROR_VAPI_500_SERVER_ERROR("pipeline-error-vapi-500-server-error"), + + PIPELINE_ERROR_OPENAI_VOICE_FAILED("pipeline-error-openai-voice-failed"), + + PIPELINE_ERROR_CARTESIA_VOICE_FAILED("pipeline-error-cartesia-voice-failed"), + + PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED("pipeline-error-deepgram-transcriber-failed"), + + PIPELINE_ERROR_DEEPGRAM_VOICE_FAILED("pipeline-error-deepgram-voice-failed"), + + PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED("pipeline-error-gladia-transcriber-failed"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_FAILED("pipeline-error-eleven-labs-voice-failed"), + + PIPELINE_ERROR_PLAYHT_VOICE_FAILED("pipeline-error-playht-voice-failed"), + + PIPELINE_ERROR_LMNT_VOICE_FAILED("pipeline-error-lmnt-voice-failed"), + + PIPELINE_ERROR_AZURE_VOICE_FAILED("pipeline-error-azure-voice-failed"), + + PIPELINE_ERROR_RIME_AI_VOICE_FAILED("pipeline-error-rime-ai-voice-failed"), + + PIPELINE_ERROR_NEETS_VOICE_FAILED("pipeline-error-neets-voice-failed"), + + PIPELINE_NO_AVAILABLE_MODEL("pipeline-no-available-model"), + + WORKER_SHUTDOWN("worker-shutdown"), + + UNKNOWN_ERROR("unknown-error"), + + VONAGE_DISCONNECTED("vonage-disconnected"), + + VONAGE_FAILED_TO_CONNECT_CALL("vonage-failed-to-connect-call"), + + PHONE_CALL_PROVIDER_BYPASS_ENABLED_BUT_NO_CALL_RECEIVED("phone-call-provider-bypass-enabled-but-no-call-received"), + + VAPIFAULT_PHONE_CALL_WORKER_SETUP_SOCKET_ERROR("vapifault-phone-call-worker-setup-socket-error"), + + VAPIFAULT_PHONE_CALL_WORKER_WORKER_SETUP_SOCKET_TIMEOUT("vapifault-phone-call-worker-worker-setup-socket-timeout"), + + VAPIFAULT_PHONE_CALL_WORKER_COULD_NOT_FIND_CALL("vapifault-phone-call-worker-could-not-find-call"), + + VAPIFAULT_TRANSPORT_NEVER_CONNECTED("vapifault-transport-never-connected"), + + VAPIFAULT_WEB_CALL_WORKER_SETUP_FAILED("vapifault-web-call-worker-setup-failed"), + + VAPIFAULT_TRANSPORT_CONNECTED_BUT_CALL_NOT_ACTIVE("vapifault-transport-connected-but-call-not-active"), + + ASSISTANT_NOT_INVALID("assistant-not-invalid"), + + ASSISTANT_NOT_PROVIDED("assistant-not-provided"), + + CALL_START_ERROR_NEITHER_ASSISTANT_NOR_SERVER_SET("call-start-error-neither-assistant-nor-server-set"), + + ASSISTANT_REQUEST_FAILED("assistant-request-failed"), + + ASSISTANT_REQUEST_RETURNED_ERROR("assistant-request-returned-error"), + + ASSISTANT_REQUEST_RETURNED_UNSPEAKABLE_ERROR("assistant-request-returned-unspeakable-error"), + + ASSISTANT_REQUEST_RETURNED_INVALID_ASSISTANT("assistant-request-returned-invalid-assistant"), + + ASSISTANT_REQUEST_RETURNED_NO_ASSISTANT("assistant-request-returned-no-assistant"), + + ASSISTANT_REQUEST_RETURNED_FORWARDING_PHONE_NUMBER("assistant-request-returned-forwarding-phone-number"), + + ASSISTANT_ENDED_CALL("assistant-ended-call"), + + ASSISTANT_SAID_END_CALL_PHRASE("assistant-said-end-call-phrase"), + + ASSISTANT_FORWARDED_CALL("assistant-forwarded-call"), + + ASSISTANT_JOIN_TIMED_OUT("assistant-join-timed-out"), + + CUSTOMER_BUSY("customer-busy"), + + CUSTOMER_ENDED_CALL("customer-ended-call"), + + CUSTOMER_DID_NOT_ANSWER("customer-did-not-answer"), + + CUSTOMER_DID_NOT_GIVE_MICROPHONE_PERMISSION("customer-did-not-give-microphone-permission"), + + ASSISTANT_SAID_MESSAGE_WITH_END_CALL_ENABLED("assistant-said-message-with-end-call-enabled"), + + EXCEEDED_MAX_DURATION("exceeded-max-duration"), + + MANUALLY_CANCELED("manually-canceled"), + + PHONE_CALL_PROVIDER_CLOSED_WEBSOCKET("phone-call-provider-closed-websocket"), + + PIPELINE_ERROR_OPENAI_400_BAD_REQUEST_VALIDATION_FAILED("pipeline-error-openai-400-bad-request-validation-failed"), + + PIPELINE_ERROR_OPENAI_401_UNAUTHORIZED("pipeline-error-openai-401-unauthorized"), + + PIPELINE_ERROR_OPENAI_403_MODEL_ACCESS_DENIED("pipeline-error-openai-403-model-access-denied"), + + PIPELINE_ERROR_OPENAI_429_EXCEEDED_QUOTA("pipeline-error-openai-429-exceeded-quota"), + + PIPELINE_ERROR_OPENAI_500_SERVER_ERROR("pipeline-error-openai-500-server-error"), + + PIPELINE_ERROR_AZURE_OPENAI_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-azure-openai-400-bad-request-validation-failed"), + + PIPELINE_ERROR_AZURE_OPENAI_401_UNAUTHORIZED("pipeline-error-azure-openai-401-unauthorized"), + + PIPELINE_ERROR_AZURE_OPENAI_403_MODEL_ACCESS_DENIED("pipeline-error-azure-openai-403-model-access-denied"), + + PIPELINE_ERROR_AZURE_OPENAI_429_EXCEEDED_QUOTA("pipeline-error-azure-openai-429-exceeded-quota"), + + PIPELINE_ERROR_AZURE_OPENAI_500_SERVER_ERROR("pipeline-error-azure-openai-500-server-error"), + + PIPELINE_ERROR_GROQ_400_BAD_REQUEST_VALIDATION_FAILED("pipeline-error-groq-400-bad-request-validation-failed"), + + PIPELINE_ERROR_GROQ_401_UNAUTHORIZED("pipeline-error-groq-401-unauthorized"), + + PIPELINE_ERROR_GROQ_403_MODEL_ACCESS_DENIED("pipeline-error-groq-403-model-access-denied"), + + PIPELINE_ERROR_GROQ_429_EXCEEDED_QUOTA("pipeline-error-groq-429-exceeded-quota"), + + PIPELINE_ERROR_GROQ_500_SERVER_ERROR("pipeline-error-groq-500-server-error"), + + PIPELINE_ERROR_ANTHROPIC_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-anthropic-400-bad-request-validation-failed"), + + PIPELINE_ERROR_ANTHROPIC_401_UNAUTHORIZED("pipeline-error-anthropic-401-unauthorized"), + + PIPELINE_ERROR_ANTHROPIC_403_MODEL_ACCESS_DENIED("pipeline-error-anthropic-403-model-access-denied"), + + PIPELINE_ERROR_ANTHROPIC_429_EXCEEDED_QUOTA("pipeline-error-anthropic-429-exceeded-quota"), + + PIPELINE_ERROR_ANTHROPIC_500_SERVER_ERROR("pipeline-error-anthropic-500-server-error"), + + PIPELINE_ERROR_TOGETHER_AI_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-together-ai-400-bad-request-validation-failed"), + + PIPELINE_ERROR_TOGETHER_AI_401_UNAUTHORIZED("pipeline-error-together-ai-401-unauthorized"), + + PIPELINE_ERROR_TOGETHER_AI_403_MODEL_ACCESS_DENIED("pipeline-error-together-ai-403-model-access-denied"), + + PIPELINE_ERROR_TOGETHER_AI_429_EXCEEDED_QUOTA("pipeline-error-together-ai-429-exceeded-quota"), + + PIPELINE_ERROR_TOGETHER_AI_500_SERVER_ERROR("pipeline-error-together-ai-500-server-error"), + + PIPELINE_ERROR_TOGETHER_AI_LLM_FAILED("pipeline-error-together-ai-llm-failed"), + + PIPELINE_ERROR_ANYSCALE_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-anyscale-400-bad-request-validation-failed"), + + PIPELINE_ERROR_ANYSCALE_401_UNAUTHORIZED("pipeline-error-anyscale-401-unauthorized"), + + PIPELINE_ERROR_ANYSCALE_403_MODEL_ACCESS_DENIED("pipeline-error-anyscale-403-model-access-denied"), + + PIPELINE_ERROR_ANYSCALE_429_EXCEEDED_QUOTA("pipeline-error-anyscale-429-exceeded-quota"), + + PIPELINE_ERROR_ANYSCALE_500_SERVER_ERROR("pipeline-error-anyscale-500-server-error"), + + PIPELINE_ERROR_ANYSCALE_LLM_FAILED("pipeline-error-anyscale-llm-failed"), + + PIPELINE_ERROR_OPENROUTER_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-openrouter-400-bad-request-validation-failed"), + + PIPELINE_ERROR_OPENROUTER_401_UNAUTHORIZED("pipeline-error-openrouter-401-unauthorized"), + + PIPELINE_ERROR_OPENROUTER_403_MODEL_ACCESS_DENIED("pipeline-error-openrouter-403-model-access-denied"), + + PIPELINE_ERROR_OPENROUTER_429_EXCEEDED_QUOTA("pipeline-error-openrouter-429-exceeded-quota"), + + PIPELINE_ERROR_OPENROUTER_500_SERVER_ERROR("pipeline-error-openrouter-500-server-error"), + + PIPELINE_ERROR_OPENROUTER_LLM_FAILED("pipeline-error-openrouter-llm-failed"), + + PIPELINE_ERROR_PERPLEXITY_AI_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-perplexity-ai-400-bad-request-validation-failed"), + + PIPELINE_ERROR_PERPLEXITY_AI_401_UNAUTHORIZED("pipeline-error-perplexity-ai-401-unauthorized"), + + PIPELINE_ERROR_PERPLEXITY_AI_403_MODEL_ACCESS_DENIED("pipeline-error-perplexity-ai-403-model-access-denied"), + + PIPELINE_ERROR_PERPLEXITY_AI_429_EXCEEDED_QUOTA("pipeline-error-perplexity-ai-429-exceeded-quota"), + + PIPELINE_ERROR_PERPLEXITY_AI_500_SERVER_ERROR("pipeline-error-perplexity-ai-500-server-error"), + + PIPELINE_ERROR_PERPLEXITY_AI_LLM_FAILED("pipeline-error-perplexity-ai-llm-failed"), + + PIPELINE_ERROR_DEEPINFRA_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-deepinfra-400-bad-request-validation-failed"), + + PIPELINE_ERROR_DEEPINFRA_401_UNAUTHORIZED("pipeline-error-deepinfra-401-unauthorized"), + + PIPELINE_ERROR_DEEPINFRA_403_MODEL_ACCESS_DENIED("pipeline-error-deepinfra-403-model-access-denied"), + + PIPELINE_ERROR_DEEPINFRA_429_EXCEEDED_QUOTA("pipeline-error-deepinfra-429-exceeded-quota"), + + PIPELINE_ERROR_DEEPINFRA_500_SERVER_ERROR("pipeline-error-deepinfra-500-server-error"), + + PIPELINE_ERROR_DEEPINFRA_LLM_FAILED("pipeline-error-deepinfra-llm-failed"), + + PIPELINE_ERROR_RUNPOD_400_BAD_REQUEST_VALIDATION_FAILED("pipeline-error-runpod-400-bad-request-validation-failed"), + + PIPELINE_ERROR_RUNPOD_401_UNAUTHORIZED("pipeline-error-runpod-401-unauthorized"), + + PIPELINE_ERROR_RUNPOD_403_MODEL_ACCESS_DENIED("pipeline-error-runpod-403-model-access-denied"), + + PIPELINE_ERROR_RUNPOD_429_EXCEEDED_QUOTA("pipeline-error-runpod-429-exceeded-quota"), + + PIPELINE_ERROR_RUNPOD_500_SERVER_ERROR("pipeline-error-runpod-500-server-error"), + + PIPELINE_ERROR_RUNPOD_LLM_FAILED("pipeline-error-runpod-llm-failed"), + + PIPELINE_ERROR_CUSTOM_LLM_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-custom-llm-400-bad-request-validation-failed"), + + PIPELINE_ERROR_CUSTOM_LLM_401_UNAUTHORIZED("pipeline-error-custom-llm-401-unauthorized"), + + PIPELINE_ERROR_CUSTOM_LLM_403_MODEL_ACCESS_DENIED("pipeline-error-custom-llm-403-model-access-denied"), + + PIPELINE_ERROR_CUSTOM_LLM_429_EXCEEDED_QUOTA("pipeline-error-custom-llm-429-exceeded-quota"), + + PIPELINE_ERROR_CUSTOM_LLM_500_SERVER_ERROR("pipeline-error-custom-llm-500-server-error"), + + PIPELINE_ERROR_CUSTOM_LLM_LLM_FAILED("pipeline-error-custom-llm-llm-failed"), + + PIPELINE_ERROR_CARTESIA_SOCKET_HANG_UP("pipeline-error-cartesia-socket-hang-up"), + + PIPELINE_ERROR_CARTESIA_REQUESTED_PAYMENT("pipeline-error-cartesia-requested-payment"), + + PIPELINE_ERROR_CARTESIA_500_SERVER_ERROR("pipeline-error-cartesia-500-server-error"), + + PIPELINE_ERROR_CARTESIA_503_SERVER_ERROR("pipeline-error-cartesia-503-server-error"), + + PIPELINE_ERROR_CARTESIA_522_SERVER_ERROR("pipeline-error-cartesia-522-server-error"), + + PIPELINE_ERROR_CUSTOM_VOICE_FAILED("pipeline-error-custom-voice-failed"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_FOUND("pipeline-error-eleven-labs-voice-not-found"), + + PIPELINE_ERROR_ELEVEN_LABS_QUOTA_EXCEEDED("pipeline-error-eleven-labs-quota-exceeded"), + + PIPELINE_ERROR_ELEVEN_LABS_UNAUTHORIZED_ACCESS("pipeline-error-eleven-labs-unauthorized-access"), + + PIPELINE_ERROR_ELEVEN_LABS_UNAUTHORIZED_TO_ACCESS_MODEL("pipeline-error-eleven-labs-unauthorized-to-access-model"), + + PIPELINE_ERROR_ELEVEN_LABS_PROFESSIONAL_VOICES_ONLY_FOR_CREATOR_PLUS( + "pipeline-error-eleven-labs-professional-voices-only-for-creator-plus"), + + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_FREE_PLAN_AND_REQUESTED_UPGRADE( + "pipeline-error-eleven-labs-blocked-free-plan-and-requested-upgrade"), + + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_CONCURRENT_REQUESTS_AND_REQUESTED_UPGRADE( + "pipeline-error-eleven-labs-blocked-concurrent-requests-and-requested-upgrade"), + + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_USING_INSTANT_VOICE_CLONE_AND_REQUESTED_UPGRADE( + "pipeline-error-eleven-labs-blocked-using-instant-voice-clone-and-requested-upgrade"), + + PIPELINE_ERROR_ELEVEN_LABS_SYSTEM_BUSY_AND_REQUESTED_UPGRADE( + "pipeline-error-eleven-labs-system-busy-and-requested-upgrade"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_FINE_TUNED("pipeline-error-eleven-labs-voice-not-fine-tuned"), + + PIPELINE_ERROR_ELEVEN_LABS_INVALID_API_KEY("pipeline-error-eleven-labs-invalid-api-key"), + + PIPELINE_ERROR_ELEVEN_LABS_INVALID_VOICE_SAMPLES("pipeline-error-eleven-labs-invalid-voice-samples"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_DISABLED_BY_OWNER("pipeline-error-eleven-labs-voice-disabled-by-owner"), + + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_ACCOUNT_IN_PROBATION("pipeline-error-eleven-labs-blocked-account-in-probation"), + + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_CONTENT_AGAINST_THEIR_POLICY( + "pipeline-error-eleven-labs-blocked-content-against-their-policy"), + + PIPELINE_ERROR_ELEVEN_LABS_MISSING_SAMPLES_FOR_VOICE_CLONE( + "pipeline-error-eleven-labs-missing-samples-for-voice-clone"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_FINE_TUNED_AND_CANNOT_BE_USED( + "pipeline-error-eleven-labs-voice-not-fine-tuned-and-cannot-be-used"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_ALLOWED_FOR_FREE_USERS( + "pipeline-error-eleven-labs-voice-not-allowed-for-free-users"), + + PIPELINE_ERROR_ELEVEN_LABS_500_SERVER_ERROR("pipeline-error-eleven-labs-500-server-error"), + + PIPELINE_ERROR_ELEVEN_LABS_MAX_CHARACTER_LIMIT_EXCEEDED("pipeline-error-eleven-labs-max-character-limit-exceeded"), + + PIPELINE_ERROR_PLAYHT_REQUEST_TIMED_OUT("pipeline-error-playht-request-timed-out"), + + PIPELINE_ERROR_PLAYHT_INVALID_VOICE("pipeline-error-playht-invalid-voice"), + + PIPELINE_ERROR_PLAYHT_UNEXPECTED_ERROR("pipeline-error-playht-unexpected-error"), + + PIPELINE_ERROR_PLAYHT_OUT_OF_CREDITS("pipeline-error-playht-out-of-credits"), + + PIPELINE_ERROR_PLAYHT_VOICE_MUST_BE_A_VALID_VOICE_MANIFEST_URI( + "pipeline-error-playht-voice-must-be-a-valid-voice-manifest-uri"), + + PIPELINE_ERROR_PLAYHT_401_UNAUTHORIZED("pipeline-error-playht-401-unauthorized"), + + PIPELINE_ERROR_PLAYHT_403_FORBIDDEN_OUT_OF_CHARACTERS("pipeline-error-playht-403-forbidden-out-of-characters"), + + PIPELINE_ERROR_PLAYHT_403_FORBIDDEN_API_ACCESS_NOT_AVAILABLE( + "pipeline-error-playht-403-forbidden-api-access-not-available"), + + PIPELINE_ERROR_PLAYHT_429_EXCEEDED_QUOTA("pipeline-error-playht-429-exceeded-quota"), + + PIPELINE_ERROR_PLAYHT_502_GATEWAY_ERROR("pipeline-error-playht-502-gateway-error"), + + PIPELINE_ERROR_PLAYHT_504_GATEWAY_ERROR("pipeline-error-playht-504-gateway-error"), + + PIPELINE_ERROR_DEEPGRAM_403_MODEL_ACCESS_DENIED("pipeline-error-deepgram-403-model-access-denied"), + + PIPELINE_ERROR_DEEPGRAM_404_NOT_FOUND("pipeline-error-deepgram-404-not-found"), + + PIPELINE_ERROR_DEEPGRAM_400_NO_SUCH_MODEL_LANGUAGE_TIER_COMBINATION( + "pipeline-error-deepgram-400-no-such-model-language-tier-combination"), + + PIPELINE_ERROR_DEEPGRAM_500_RETURNING_INVALID_JSON("pipeline-error-deepgram-500-returning-invalid-json"), + + SIP_GATEWAY_FAILED_TO_CONNECT_CALL("sip-gateway-failed-to-connect-call"), + + SILENCE_TIMED_OUT("silence-timed-out"), + + TWILIO_FAILED_TO_CONNECT_CALL("twilio-failed-to-connect-call"), + + TWILIO_REPORTED_CUSTOMER_MISDIALED("twilio-reported-customer-misdialed"), + + VOICEMAIL("voicemail"), + + VONAGE_REJECTED("vonage-rejected"); + + private final String value; + + ServerMessageEndOfCallReportEndedReason(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageEndOfCallReportPhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessageEndOfCallReportPhoneNumber.java new file mode 100644 index 0000000..724c291 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageEndOfCallReportPhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageEndOfCallReportPhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageEndOfCallReportPhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageEndOfCallReportPhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessageEndOfCallReportPhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessageEndOfCallReportPhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessageEndOfCallReportPhoneNumber(new TwilioValue(value)); + } + + public static ServerMessageEndOfCallReportPhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessageEndOfCallReportPhoneNumber(new VonageValue(value)); + } + + public static ServerMessageEndOfCallReportPhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessageEndOfCallReportPhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageEndOfCallReportPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageEndOfCallReportPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageEndOfCallReportPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageEndOfCallReportPhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageEndOfCallReportPhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageHang.java b/src/main/java/com/vapi/api/types/ServerMessageHang.java new file mode 100644 index 0000000..e8a3aee --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageHang.java @@ -0,0 +1,258 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageHang.Builder.class) +public final class ServerMessageHang { + private final Optional phoneNumber; + + private final Optional timestamp; + + private final Optional artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final Map additionalProperties; + + private ServerMessageHang( + Optional phoneNumber, + Optional timestamp, + Optional artifact, + Optional assistant, + Optional customer, + Optional call, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return This is a live version of the call.artifact. + *

This matches what is stored on call.artifact after the call.

+ */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageHang && equalTo((ServerMessageHang) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageHang other) { + return phoneNumber.equals(other.phoneNumber) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.phoneNumber, this.timestamp, this.artifact, this.assistant, this.customer, this.call); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional phoneNumber = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional call = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ServerMessageHang other) { + phoneNumber(other.getPhoneNumber()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + return this; + } + + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public Builder phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + public Builder phoneNumber(ServerMessageHangPhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public Builder timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + public Builder timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public Builder artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + public Builder artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public Builder assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + public Builder assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public Builder customer(Optional customer) { + this.customer = customer; + return this; + } + + public Builder customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public Builder call(Optional call) { + this.call = call; + return this; + } + + public Builder call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + public ServerMessageHang build() { + return new ServerMessageHang( + phoneNumber, timestamp, artifact, assistant, customer, call, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageHangPhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessageHangPhoneNumber.java new file mode 100644 index 0000000..062e2c2 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageHangPhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageHangPhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageHangPhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageHangPhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessageHangPhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessageHangPhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessageHangPhoneNumber(new TwilioValue(value)); + } + + public static ServerMessageHangPhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessageHangPhoneNumber(new VonageValue(value)); + } + + public static ServerMessageHangPhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessageHangPhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageHangPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageHangPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageHangPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageHangPhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageHangPhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageLanguageChanged.java b/src/main/java/com/vapi/api/types/ServerMessageLanguageChanged.java new file mode 100644 index 0000000..a594ca0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageLanguageChanged.java @@ -0,0 +1,387 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageLanguageChanged.Builder.class) +public final class ServerMessageLanguageChanged { + private final Optional phoneNumber; + + private final Optional timestamp; + + private final Optional artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final String language; + + private final Map additionalProperties; + + private ServerMessageLanguageChanged( + Optional phoneNumber, + Optional timestamp, + Optional artifact, + Optional assistant, + Optional customer, + Optional call, + String language, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.language = language; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return This is a live version of the call.artifact. + *

This matches what is stored on call.artifact after the call.

+ */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + /** + * @return This is the language the transcriber is switched to. + */ + @JsonProperty("language") + public String getLanguage() { + return language; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageLanguageChanged && equalTo((ServerMessageLanguageChanged) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageLanguageChanged other) { + return phoneNumber.equals(other.phoneNumber) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call) + && language.equals(other.language); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.phoneNumber, + this.timestamp, + this.artifact, + this.assistant, + this.customer, + this.call, + this.language); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LanguageStage builder() { + return new Builder(); + } + + public interface LanguageStage { + _FinalStage language(@NotNull String language); + + Builder from(ServerMessageLanguageChanged other); + } + + public interface _FinalStage { + ServerMessageLanguageChanged build(); + + _FinalStage phoneNumber(Optional phoneNumber); + + _FinalStage phoneNumber(ServerMessageLanguageChangedPhoneNumber phoneNumber); + + _FinalStage timestamp(Optional timestamp); + + _FinalStage timestamp(String timestamp); + + _FinalStage artifact(Optional artifact); + + _FinalStage artifact(Artifact artifact); + + _FinalStage assistant(Optional assistant); + + _FinalStage assistant(CreateAssistantDto assistant); + + _FinalStage customer(Optional customer); + + _FinalStage customer(CreateCustomerDto customer); + + _FinalStage call(Optional call); + + _FinalStage call(Call call); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LanguageStage, _FinalStage { + private String language; + + private Optional call = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Optional phoneNumber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ServerMessageLanguageChanged other) { + phoneNumber(other.getPhoneNumber()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + language(other.getLanguage()); + return this; + } + + /** + *

This is the language the transcriber is switched to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("language") + public _FinalStage language(@NotNull String language) { + this.language = Objects.requireNonNull(language, "language must not be null"); + return this; + } + + /** + *

This is the call object.

+ *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + @java.lang.Override + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public _FinalStage call(Optional call) { + this.call = call; + return this; + } + + /** + *

This is the customer associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @java.lang.Override + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public _FinalStage customer(Optional customer) { + this.customer = customer; + return this; + } + + /** + *

This is the assistant that is currently active. This is provided for convenience.

+ *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public _FinalStage assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + /** + *

This is a live version of the call.artifact.

+ *

This matches what is stored on call.artifact after the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @java.lang.Override + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public _FinalStage artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + /** + *

This is the ISO-8601 formatted timestamp of when the message was sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @java.lang.Override + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public _FinalStage timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + *

This is the phone number associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneNumber(ServerMessageLanguageChangedPhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public _FinalStage phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + @java.lang.Override + public ServerMessageLanguageChanged build() { + return new ServerMessageLanguageChanged( + phoneNumber, timestamp, artifact, assistant, customer, call, language, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageLanguageChangedPhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessageLanguageChangedPhoneNumber.java new file mode 100644 index 0000000..1c8540c --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageLanguageChangedPhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageLanguageChangedPhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageLanguageChangedPhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageLanguageChangedPhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessageLanguageChangedPhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessageLanguageChangedPhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessageLanguageChangedPhoneNumber(new TwilioValue(value)); + } + + public static ServerMessageLanguageChangedPhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessageLanguageChangedPhoneNumber(new VonageValue(value)); + } + + public static ServerMessageLanguageChangedPhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessageLanguageChangedPhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageLanguageChangedPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageLanguageChangedPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageLanguageChangedPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageLanguageChangedPhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageLanguageChangedPhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageMessage.java b/src/main/java/com/vapi/api/types/ServerMessageMessage.java new file mode 100644 index 0000000..2a7021e --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageMessage.java @@ -0,0 +1,987 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageMessage { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageMessage(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageMessage assistantRequest(ServerMessageAssistantRequest value) { + return new ServerMessageMessage(new AssistantRequestValue(value)); + } + + public static ServerMessageMessage conversationUpdate(ServerMessageConversationUpdate value) { + return new ServerMessageMessage(new ConversationUpdateValue(value)); + } + + public static ServerMessageMessage endOfCallReport(ServerMessageEndOfCallReport value) { + return new ServerMessageMessage(new EndOfCallReportValue(value)); + } + + public static ServerMessageMessage hang(ServerMessageHang value) { + return new ServerMessageMessage(new HangValue(value)); + } + + public static ServerMessageMessage modelOutput(ServerMessageModelOutput value) { + return new ServerMessageMessage(new ModelOutputValue(value)); + } + + public static ServerMessageMessage phoneCallControl(ServerMessagePhoneCallControl value) { + return new ServerMessageMessage(new PhoneCallControlValue(value)); + } + + public static ServerMessageMessage speechUpdate(ServerMessageSpeechUpdate value) { + return new ServerMessageMessage(new SpeechUpdateValue(value)); + } + + public static ServerMessageMessage statusUpdate(ServerMessageStatusUpdate value) { + return new ServerMessageMessage(new StatusUpdateValue(value)); + } + + public static ServerMessageMessage toolCalls(ServerMessageToolCalls value) { + return new ServerMessageMessage(new ToolCallsValue(value)); + } + + public static ServerMessageMessage transferDestinationRequest(ServerMessageTransferDestinationRequest value) { + return new ServerMessageMessage(new TransferDestinationRequestValue(value)); + } + + public static ServerMessageMessage transferUpdate(ServerMessageTransferUpdate value) { + return new ServerMessageMessage(new TransferUpdateValue(value)); + } + + public static ServerMessageMessage transcript(ServerMessageTranscript value) { + return new ServerMessageMessage(new TranscriptValue(value)); + } + + public static ServerMessageMessage userInterrupted(ServerMessageUserInterrupted value) { + return new ServerMessageMessage(new UserInterruptedValue(value)); + } + + public static ServerMessageMessage languageChanged(ServerMessageLanguageChanged value) { + return new ServerMessageMessage(new LanguageChangedValue(value)); + } + + public static ServerMessageMessage voiceInput(ServerMessageVoiceInput value) { + return new ServerMessageMessage(new VoiceInputValue(value)); + } + + public static ServerMessageMessage voiceRequest(ServerMessageVoiceRequest value) { + return new ServerMessageMessage(new VoiceRequestValue(value)); + } + + public boolean isAssistantRequest() { + return value instanceof AssistantRequestValue; + } + + public boolean isConversationUpdate() { + return value instanceof ConversationUpdateValue; + } + + public boolean isEndOfCallReport() { + return value instanceof EndOfCallReportValue; + } + + public boolean isHang() { + return value instanceof HangValue; + } + + public boolean isModelOutput() { + return value instanceof ModelOutputValue; + } + + public boolean isPhoneCallControl() { + return value instanceof PhoneCallControlValue; + } + + public boolean isSpeechUpdate() { + return value instanceof SpeechUpdateValue; + } + + public boolean isStatusUpdate() { + return value instanceof StatusUpdateValue; + } + + public boolean isToolCalls() { + return value instanceof ToolCallsValue; + } + + public boolean isTransferDestinationRequest() { + return value instanceof TransferDestinationRequestValue; + } + + public boolean isTransferUpdate() { + return value instanceof TransferUpdateValue; + } + + public boolean isTranscript() { + return value instanceof TranscriptValue; + } + + public boolean isUserInterrupted() { + return value instanceof UserInterruptedValue; + } + + public boolean isLanguageChanged() { + return value instanceof LanguageChangedValue; + } + + public boolean isVoiceInput() { + return value instanceof VoiceInputValue; + } + + public boolean isVoiceRequest() { + return value instanceof VoiceRequestValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAssistantRequest() { + if (isAssistantRequest()) { + return Optional.of(((AssistantRequestValue) value).value); + } + return Optional.empty(); + } + + public Optional getConversationUpdate() { + if (isConversationUpdate()) { + return Optional.of(((ConversationUpdateValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndOfCallReport() { + if (isEndOfCallReport()) { + return Optional.of(((EndOfCallReportValue) value).value); + } + return Optional.empty(); + } + + public Optional getHang() { + if (isHang()) { + return Optional.of(((HangValue) value).value); + } + return Optional.empty(); + } + + public Optional getModelOutput() { + if (isModelOutput()) { + return Optional.of(((ModelOutputValue) value).value); + } + return Optional.empty(); + } + + public Optional getPhoneCallControl() { + if (isPhoneCallControl()) { + return Optional.of(((PhoneCallControlValue) value).value); + } + return Optional.empty(); + } + + public Optional getSpeechUpdate() { + if (isSpeechUpdate()) { + return Optional.of(((SpeechUpdateValue) value).value); + } + return Optional.empty(); + } + + public Optional getStatusUpdate() { + if (isStatusUpdate()) { + return Optional.of(((StatusUpdateValue) value).value); + } + return Optional.empty(); + } + + public Optional getToolCalls() { + if (isToolCalls()) { + return Optional.of(((ToolCallsValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferDestinationRequest() { + if (isTransferDestinationRequest()) { + return Optional.of(((TransferDestinationRequestValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferUpdate() { + if (isTransferUpdate()) { + return Optional.of(((TransferUpdateValue) value).value); + } + return Optional.empty(); + } + + public Optional getTranscript() { + if (isTranscript()) { + return Optional.of(((TranscriptValue) value).value); + } + return Optional.empty(); + } + + public Optional getUserInterrupted() { + if (isUserInterrupted()) { + return Optional.of(((UserInterruptedValue) value).value); + } + return Optional.empty(); + } + + public Optional getLanguageChanged() { + if (isLanguageChanged()) { + return Optional.of(((LanguageChangedValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoiceInput() { + if (isVoiceInput()) { + return Optional.of(((VoiceInputValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoiceRequest() { + if (isVoiceRequest()) { + return Optional.of(((VoiceRequestValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAssistantRequest(ServerMessageAssistantRequest assistantRequest); + + T visitConversationUpdate(ServerMessageConversationUpdate conversationUpdate); + + T visitEndOfCallReport(ServerMessageEndOfCallReport endOfCallReport); + + T visitHang(ServerMessageHang hang); + + T visitModelOutput(ServerMessageModelOutput modelOutput); + + T visitPhoneCallControl(ServerMessagePhoneCallControl phoneCallControl); + + T visitSpeechUpdate(ServerMessageSpeechUpdate speechUpdate); + + T visitStatusUpdate(ServerMessageStatusUpdate statusUpdate); + + T visitToolCalls(ServerMessageToolCalls toolCalls); + + T visitTransferDestinationRequest(ServerMessageTransferDestinationRequest transferDestinationRequest); + + T visitTransferUpdate(ServerMessageTransferUpdate transferUpdate); + + T visitTranscript(ServerMessageTranscript transcript); + + T visitUserInterrupted(ServerMessageUserInterrupted userInterrupted); + + T visitLanguageChanged(ServerMessageLanguageChanged languageChanged); + + T visitVoiceInput(ServerMessageVoiceInput voiceInput); + + T visitVoiceRequest(ServerMessageVoiceRequest voiceRequest); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AssistantRequestValue.class), + @JsonSubTypes.Type(ConversationUpdateValue.class), + @JsonSubTypes.Type(EndOfCallReportValue.class), + @JsonSubTypes.Type(HangValue.class), + @JsonSubTypes.Type(ModelOutputValue.class), + @JsonSubTypes.Type(PhoneCallControlValue.class), + @JsonSubTypes.Type(SpeechUpdateValue.class), + @JsonSubTypes.Type(StatusUpdateValue.class), + @JsonSubTypes.Type(ToolCallsValue.class), + @JsonSubTypes.Type(TransferDestinationRequestValue.class), + @JsonSubTypes.Type(TransferUpdateValue.class), + @JsonSubTypes.Type(TranscriptValue.class), + @JsonSubTypes.Type(UserInterruptedValue.class), + @JsonSubTypes.Type(LanguageChangedValue.class), + @JsonSubTypes.Type(VoiceInputValue.class), + @JsonSubTypes.Type(VoiceRequestValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("assistant-request") + private static final class AssistantRequestValue implements Value { + @JsonUnwrapped + private ServerMessageAssistantRequest value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AssistantRequestValue() {} + + private AssistantRequestValue(ServerMessageAssistantRequest value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAssistantRequest(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AssistantRequestValue && equalTo((AssistantRequestValue) other); + } + + private boolean equalTo(AssistantRequestValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("conversation-update") + private static final class ConversationUpdateValue implements Value { + @JsonUnwrapped + private ServerMessageConversationUpdate value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ConversationUpdateValue() {} + + private ConversationUpdateValue(ServerMessageConversationUpdate value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitConversationUpdate(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConversationUpdateValue && equalTo((ConversationUpdateValue) other); + } + + private boolean equalTo(ConversationUpdateValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("end-of-call-report") + private static final class EndOfCallReportValue implements Value { + @JsonUnwrapped + private ServerMessageEndOfCallReport value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndOfCallReportValue() {} + + private EndOfCallReportValue(ServerMessageEndOfCallReport value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndOfCallReport(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndOfCallReportValue && equalTo((EndOfCallReportValue) other); + } + + private boolean equalTo(EndOfCallReportValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("hang") + private static final class HangValue implements Value { + @JsonUnwrapped + private ServerMessageHang value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private HangValue() {} + + private HangValue(ServerMessageHang value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitHang(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof HangValue && equalTo((HangValue) other); + } + + private boolean equalTo(HangValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("model-output") + private static final class ModelOutputValue implements Value { + @JsonUnwrapped + private ServerMessageModelOutput value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ModelOutputValue() {} + + private ModelOutputValue(ServerMessageModelOutput value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitModelOutput(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ModelOutputValue && equalTo((ModelOutputValue) other); + } + + private boolean equalTo(ModelOutputValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("phone-call-control") + private static final class PhoneCallControlValue implements Value { + @JsonUnwrapped + private ServerMessagePhoneCallControl value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private PhoneCallControlValue() {} + + private PhoneCallControlValue(ServerMessagePhoneCallControl value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitPhoneCallControl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PhoneCallControlValue && equalTo((PhoneCallControlValue) other); + } + + private boolean equalTo(PhoneCallControlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("speech-update") + private static final class SpeechUpdateValue implements Value { + @JsonUnwrapped + private ServerMessageSpeechUpdate value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SpeechUpdateValue() {} + + private SpeechUpdateValue(ServerMessageSpeechUpdate value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSpeechUpdate(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SpeechUpdateValue && equalTo((SpeechUpdateValue) other); + } + + private boolean equalTo(SpeechUpdateValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("status-update") + private static final class StatusUpdateValue implements Value { + @JsonUnwrapped + private ServerMessageStatusUpdate value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private StatusUpdateValue() {} + + private StatusUpdateValue(ServerMessageStatusUpdate value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitStatusUpdate(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StatusUpdateValue && equalTo((StatusUpdateValue) other); + } + + private boolean equalTo(StatusUpdateValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("tool-calls") + private static final class ToolCallsValue implements Value { + @JsonUnwrapped + private ServerMessageToolCalls value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ToolCallsValue() {} + + private ToolCallsValue(ServerMessageToolCalls value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitToolCalls(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallsValue && equalTo((ToolCallsValue) other); + } + + private boolean equalTo(ToolCallsValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transfer-destination-request") + private static final class TransferDestinationRequestValue implements Value { + @JsonUnwrapped + private ServerMessageTransferDestinationRequest value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferDestinationRequestValue() {} + + private TransferDestinationRequestValue(ServerMessageTransferDestinationRequest value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferDestinationRequest(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferDestinationRequestValue && equalTo((TransferDestinationRequestValue) other); + } + + private boolean equalTo(TransferDestinationRequestValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transfer-update") + private static final class TransferUpdateValue implements Value { + @JsonUnwrapped + private ServerMessageTransferUpdate value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferUpdateValue() {} + + private TransferUpdateValue(ServerMessageTransferUpdate value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferUpdate(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferUpdateValue && equalTo((TransferUpdateValue) other); + } + + private boolean equalTo(TransferUpdateValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transcript") + private static final class TranscriptValue implements Value { + @JsonUnwrapped + private ServerMessageTranscript value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TranscriptValue() {} + + private TranscriptValue(ServerMessageTranscript value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTranscript(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TranscriptValue && equalTo((TranscriptValue) other); + } + + private boolean equalTo(TranscriptValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("user-interrupted") + private static final class UserInterruptedValue implements Value { + @JsonUnwrapped + private ServerMessageUserInterrupted value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private UserInterruptedValue() {} + + private UserInterruptedValue(ServerMessageUserInterrupted value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitUserInterrupted(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserInterruptedValue && equalTo((UserInterruptedValue) other); + } + + private boolean equalTo(UserInterruptedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("language-changed") + private static final class LanguageChangedValue implements Value { + @JsonUnwrapped + private ServerMessageLanguageChanged value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private LanguageChangedValue() {} + + private LanguageChangedValue(ServerMessageLanguageChanged value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitLanguageChanged(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LanguageChangedValue && equalTo((LanguageChangedValue) other); + } + + private boolean equalTo(LanguageChangedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voice-input") + private static final class VoiceInputValue implements Value { + @JsonUnwrapped + private ServerMessageVoiceInput value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoiceInputValue() {} + + private VoiceInputValue(ServerMessageVoiceInput value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoiceInput(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoiceInputValue && equalTo((VoiceInputValue) other); + } + + private boolean equalTo(VoiceInputValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voice-request") + private static final class VoiceRequestValue implements Value { + @JsonUnwrapped + private ServerMessageVoiceRequest value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoiceRequestValue() {} + + private VoiceRequestValue(ServerMessageVoiceRequest value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoiceRequest(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoiceRequestValue && equalTo((VoiceRequestValue) other); + } + + private boolean equalTo(VoiceRequestValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageMessage{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageModelOutput.java b/src/main/java/com/vapi/api/types/ServerMessageModelOutput.java new file mode 100644 index 0000000..f1418a6 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageModelOutput.java @@ -0,0 +1,293 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageModelOutput.Builder.class) +public final class ServerMessageModelOutput { + private final Optional phoneNumber; + + private final Optional timestamp; + + private final Optional artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final Map output; + + private final Map additionalProperties; + + private ServerMessageModelOutput( + Optional phoneNumber, + Optional timestamp, + Optional artifact, + Optional assistant, + Optional customer, + Optional call, + Map output, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.output = output; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return This is a live version of the call.artifact. + *

This matches what is stored on call.artifact after the call.

+ */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + /** + * @return This is the output of the model. It can be a token or tool call. + */ + @JsonProperty("output") + public Map getOutput() { + return output; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageModelOutput && equalTo((ServerMessageModelOutput) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageModelOutput other) { + return phoneNumber.equals(other.phoneNumber) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call) + && output.equals(other.output); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.phoneNumber, this.timestamp, this.artifact, this.assistant, this.customer, this.call, this.output); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional phoneNumber = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional call = Optional.empty(); + + private Map output = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ServerMessageModelOutput other) { + phoneNumber(other.getPhoneNumber()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + output(other.getOutput()); + return this; + } + + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public Builder phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + public Builder phoneNumber(ServerMessageModelOutputPhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public Builder timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + public Builder timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public Builder artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + public Builder artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public Builder assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + public Builder assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public Builder customer(Optional customer) { + this.customer = customer; + return this; + } + + public Builder customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public Builder call(Optional call) { + this.call = call; + return this; + } + + public Builder call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + @JsonSetter(value = "output", nulls = Nulls.SKIP) + public Builder output(Map output) { + this.output.clear(); + this.output.putAll(output); + return this; + } + + public Builder putAllOutput(Map output) { + this.output.putAll(output); + return this; + } + + public Builder output(String key, Object value) { + this.output.put(key, value); + return this; + } + + public ServerMessageModelOutput build() { + return new ServerMessageModelOutput( + phoneNumber, timestamp, artifact, assistant, customer, call, output, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageModelOutputPhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessageModelOutputPhoneNumber.java new file mode 100644 index 0000000..8ddbb5f --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageModelOutputPhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageModelOutputPhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageModelOutputPhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageModelOutputPhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessageModelOutputPhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessageModelOutputPhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessageModelOutputPhoneNumber(new TwilioValue(value)); + } + + public static ServerMessageModelOutputPhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessageModelOutputPhoneNumber(new VonageValue(value)); + } + + public static ServerMessageModelOutputPhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessageModelOutputPhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageModelOutputPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageModelOutputPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageModelOutputPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageModelOutputPhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageModelOutputPhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessagePhoneCallControl.java b/src/main/java/com/vapi/api/types/ServerMessagePhoneCallControl.java new file mode 100644 index 0000000..b9da1b9 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessagePhoneCallControl.java @@ -0,0 +1,433 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessagePhoneCallControl.Builder.class) +public final class ServerMessagePhoneCallControl { + private final Optional phoneNumber; + + private final ServerMessagePhoneCallControlRequest request; + + private final Optional destination; + + private final Optional timestamp; + + private final Optional artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final Map additionalProperties; + + private ServerMessagePhoneCallControl( + Optional phoneNumber, + ServerMessagePhoneCallControlRequest request, + Optional destination, + Optional timestamp, + Optional artifact, + Optional assistant, + Optional customer, + Optional call, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.request = request; + this.destination = destination; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the request to control the phone call. + */ + @JsonProperty("request") + public ServerMessagePhoneCallControlRequest getRequest() { + return request; + } + + /** + * @return This is the destination to forward the call to if the request is "forward". + */ + @JsonProperty("destination") + public Optional getDestination() { + return destination; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return This is a live version of the call.artifact. + *

This matches what is stored on call.artifact after the call.

+ */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessagePhoneCallControl && equalTo((ServerMessagePhoneCallControl) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessagePhoneCallControl other) { + return phoneNumber.equals(other.phoneNumber) + && request.equals(other.request) + && destination.equals(other.destination) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.phoneNumber, + this.request, + this.destination, + this.timestamp, + this.artifact, + this.assistant, + this.customer, + this.call); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RequestStage builder() { + return new Builder(); + } + + public interface RequestStage { + _FinalStage request(@NotNull ServerMessagePhoneCallControlRequest request); + + Builder from(ServerMessagePhoneCallControl other); + } + + public interface _FinalStage { + ServerMessagePhoneCallControl build(); + + _FinalStage phoneNumber(Optional phoneNumber); + + _FinalStage phoneNumber(ServerMessagePhoneCallControlPhoneNumber phoneNumber); + + _FinalStage destination(Optional destination); + + _FinalStage destination(ServerMessagePhoneCallControlDestination destination); + + _FinalStage timestamp(Optional timestamp); + + _FinalStage timestamp(String timestamp); + + _FinalStage artifact(Optional artifact); + + _FinalStage artifact(Artifact artifact); + + _FinalStage assistant(Optional assistant); + + _FinalStage assistant(CreateAssistantDto assistant); + + _FinalStage customer(Optional customer); + + _FinalStage customer(CreateCustomerDto customer); + + _FinalStage call(Optional call); + + _FinalStage call(Call call); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RequestStage, _FinalStage { + private ServerMessagePhoneCallControlRequest request; + + private Optional call = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Optional destination = Optional.empty(); + + private Optional phoneNumber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ServerMessagePhoneCallControl other) { + phoneNumber(other.getPhoneNumber()); + request(other.getRequest()); + destination(other.getDestination()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + return this; + } + + /** + *

This is the request to control the phone call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("request") + public _FinalStage request(@NotNull ServerMessagePhoneCallControlRequest request) { + this.request = Objects.requireNonNull(request, "request must not be null"); + return this; + } + + /** + *

This is the call object.

+ *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + @java.lang.Override + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public _FinalStage call(Optional call) { + this.call = call; + return this; + } + + /** + *

This is the customer associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @java.lang.Override + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public _FinalStage customer(Optional customer) { + this.customer = customer; + return this; + } + + /** + *

This is the assistant that is currently active. This is provided for convenience.

+ *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public _FinalStage assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + /** + *

This is a live version of the call.artifact.

+ *

This matches what is stored on call.artifact after the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @java.lang.Override + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public _FinalStage artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + /** + *

This is the ISO-8601 formatted timestamp of when the message was sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @java.lang.Override + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public _FinalStage timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + *

This is the destination to forward the call to if the request is "forward".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destination(ServerMessagePhoneCallControlDestination destination) { + this.destination = Optional.ofNullable(destination); + return this; + } + + @java.lang.Override + @JsonSetter(value = "destination", nulls = Nulls.SKIP) + public _FinalStage destination(Optional destination) { + this.destination = destination; + return this; + } + + /** + *

This is the phone number associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneNumber(ServerMessagePhoneCallControlPhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public _FinalStage phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + @java.lang.Override + public ServerMessagePhoneCallControl build() { + return new ServerMessagePhoneCallControl( + phoneNumber, + request, + destination, + timestamp, + artifact, + assistant, + customer, + call, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessagePhoneCallControlDestination.java b/src/main/java/com/vapi/api/types/ServerMessagePhoneCallControlDestination.java new file mode 100644 index 0000000..9cb7c3f --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessagePhoneCallControlDestination.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessagePhoneCallControlDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessagePhoneCallControlDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessagePhoneCallControlDestination number(TransferDestinationNumber value) { + return new ServerMessagePhoneCallControlDestination(new NumberValue(value)); + } + + public static ServerMessagePhoneCallControlDestination sip(TransferDestinationSip value) { + return new ServerMessagePhoneCallControlDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessagePhoneCallControlDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessagePhoneCallControlDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessagePhoneCallControlDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessagePhoneCallControlPhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessagePhoneCallControlPhoneNumber.java new file mode 100644 index 0000000..940ead1 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessagePhoneCallControlPhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessagePhoneCallControlPhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessagePhoneCallControlPhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessagePhoneCallControlPhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessagePhoneCallControlPhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessagePhoneCallControlPhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessagePhoneCallControlPhoneNumber(new TwilioValue(value)); + } + + public static ServerMessagePhoneCallControlPhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessagePhoneCallControlPhoneNumber(new VonageValue(value)); + } + + public static ServerMessagePhoneCallControlPhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessagePhoneCallControlPhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessagePhoneCallControlPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessagePhoneCallControlPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessagePhoneCallControlPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessagePhoneCallControlPhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessagePhoneCallControlPhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessagePhoneCallControlRequest.java b/src/main/java/com/vapi/api/types/ServerMessagePhoneCallControlRequest.java new file mode 100644 index 0000000..0d289c8 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessagePhoneCallControlRequest.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ServerMessagePhoneCallControlRequest { + FORWARD("forward"), + + HANG_UP("hang-up"); + + private final String value; + + ServerMessagePhoneCallControlRequest(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageResponse.java b/src/main/java/com/vapi/api/types/ServerMessageResponse.java new file mode 100644 index 0000000..d8330b4 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageResponse.java @@ -0,0 +1,112 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageResponse.Builder.class) +public final class ServerMessageResponse { + private final ServerMessageResponseMessageResponse messageResponse; + + private final Map additionalProperties; + + private ServerMessageResponse( + ServerMessageResponseMessageResponse messageResponse, Map additionalProperties) { + this.messageResponse = messageResponse; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the response that is expected from the server to the message. + *

Note: Most messages don't expect a response. Only "assistant-request", "tool-calls" and "transfer-destination-request" do.

+ */ + @JsonProperty("messageResponse") + public ServerMessageResponseMessageResponse getMessageResponse() { + return messageResponse; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageResponse && equalTo((ServerMessageResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageResponse other) { + return messageResponse.equals(other.messageResponse); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.messageResponse); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MessageResponseStage builder() { + return new Builder(); + } + + public interface MessageResponseStage { + _FinalStage messageResponse(@NotNull ServerMessageResponseMessageResponse messageResponse); + + Builder from(ServerMessageResponse other); + } + + public interface _FinalStage { + ServerMessageResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MessageResponseStage, _FinalStage { + private ServerMessageResponseMessageResponse messageResponse; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ServerMessageResponse other) { + messageResponse(other.getMessageResponse()); + return this; + } + + /** + *

This is the response that is expected from the server to the message.

+ *

Note: Most messages don't expect a response. Only "assistant-request", "tool-calls" and "transfer-destination-request" do.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("messageResponse") + public _FinalStage messageResponse(@NotNull ServerMessageResponseMessageResponse messageResponse) { + this.messageResponse = Objects.requireNonNull(messageResponse, "messageResponse must not be null"); + return this; + } + + @java.lang.Override + public ServerMessageResponse build() { + return new ServerMessageResponse(messageResponse, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageResponseAssistantRequest.java b/src/main/java/com/vapi/api/types/ServerMessageResponseAssistantRequest.java new file mode 100644 index 0000000..dc2c54c --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageResponseAssistantRequest.java @@ -0,0 +1,281 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageResponseAssistantRequest.Builder.class) +public final class ServerMessageResponseAssistantRequest { + private final Optional destination; + + private final Optional assistantId; + + private final Optional assistant; + + private final Optional assistantOverrides; + + private final Optional squadId; + + private final Optional squad; + + private final Optional error; + + private final Map additionalProperties; + + private ServerMessageResponseAssistantRequest( + Optional destination, + Optional assistantId, + Optional assistant, + Optional assistantOverrides, + Optional squadId, + Optional squad, + Optional error, + Map additionalProperties) { + this.destination = destination; + this.assistantId = assistantId; + this.assistant = assistant; + this.assistantOverrides = assistantOverrides; + this.squadId = squadId; + this.squad = squad; + this.error = error; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the destination to transfer the inbound call to. This will immediately transfer without using any assistants. + *

If this is sent, assistantId, assistant, squadId, and squad are ignored.

+ */ + @JsonProperty("destination") + public Optional getDestination() { + return destination; + } + + /** + * @return This is the assistant that will be used for the call. To use a transient assistant, use assistant instead. + */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the assistant that will be used for the call. To use an existing assistant, use assistantId instead. + *

If you're unsure why you're getting an invalid assistant, try logging your response and send the JSON blob to POST /assistant which will return the validation errors.

+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return These are the overrides for the assistant or assistantId's settings and template variables. + */ + @JsonProperty("assistantOverrides") + public Optional getAssistantOverrides() { + return assistantOverrides; + } + + /** + * @return This is the squad that will be used for the call. To use a transient squad, use squad instead. + */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is a squad that will be used for the call. To use an existing squad, use squadId instead. + */ + @JsonProperty("squad") + public Optional getSquad() { + return squad; + } + + /** + * @return This is the error if the call shouldn't be accepted. This is spoken to the customer. + *

If this is sent, assistantId, assistant, squadId, squad, and destination are ignored.

+ */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageResponseAssistantRequest + && equalTo((ServerMessageResponseAssistantRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageResponseAssistantRequest other) { + return destination.equals(other.destination) + && assistantId.equals(other.assistantId) + && assistant.equals(other.assistant) + && assistantOverrides.equals(other.assistantOverrides) + && squadId.equals(other.squadId) + && squad.equals(other.squad) + && error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.destination, + this.assistantId, + this.assistant, + this.assistantOverrides, + this.squadId, + this.squad, + this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional destination = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional assistantOverrides = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional squad = Optional.empty(); + + private Optional error = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ServerMessageResponseAssistantRequest other) { + destination(other.getDestination()); + assistantId(other.getAssistantId()); + assistant(other.getAssistant()); + assistantOverrides(other.getAssistantOverrides()); + squadId(other.getSquadId()); + squad(other.getSquad()); + error(other.getError()); + return this; + } + + @JsonSetter(value = "destination", nulls = Nulls.SKIP) + public Builder destination(Optional destination) { + this.destination = destination; + return this; + } + + public Builder destination(ServerMessageResponseAssistantRequestDestination destination) { + this.destination = Optional.ofNullable(destination); + return this; + } + + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public Builder assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + public Builder assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public Builder assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + public Builder assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @JsonSetter(value = "assistantOverrides", nulls = Nulls.SKIP) + public Builder assistantOverrides(Optional assistantOverrides) { + this.assistantOverrides = assistantOverrides; + return this; + } + + public Builder assistantOverrides(AssistantOverrides assistantOverrides) { + this.assistantOverrides = Optional.ofNullable(assistantOverrides); + return this; + } + + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public Builder squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + public Builder squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @JsonSetter(value = "squad", nulls = Nulls.SKIP) + public Builder squad(Optional squad) { + this.squad = squad; + return this; + } + + public Builder squad(CreateSquadDto squad) { + this.squad = Optional.ofNullable(squad); + return this; + } + + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public Builder error(Optional error) { + this.error = error; + return this; + } + + public Builder error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + public ServerMessageResponseAssistantRequest build() { + return new ServerMessageResponseAssistantRequest( + destination, + assistantId, + assistant, + assistantOverrides, + squadId, + squad, + error, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageResponseAssistantRequestDestination.java b/src/main/java/com/vapi/api/types/ServerMessageResponseAssistantRequestDestination.java new file mode 100644 index 0000000..83dbe94 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageResponseAssistantRequestDestination.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageResponseAssistantRequestDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageResponseAssistantRequestDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageResponseAssistantRequestDestination number(TransferDestinationNumber value) { + return new ServerMessageResponseAssistantRequestDestination(new NumberValue(value)); + } + + public static ServerMessageResponseAssistantRequestDestination sip(TransferDestinationSip value) { + return new ServerMessageResponseAssistantRequestDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageResponseAssistantRequestDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageResponseAssistantRequestDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageResponseAssistantRequestDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageResponseMessageResponse.java b/src/main/java/com/vapi/api/types/ServerMessageResponseMessageResponse.java new file mode 100644 index 0000000..a6c6fbd --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageResponseMessageResponse.java @@ -0,0 +1,121 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.vapi.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = ServerMessageResponseMessageResponse.Deserializer.class) +public final class ServerMessageResponseMessageResponse { + private final Object value; + + private final int type; + + private ServerMessageResponseMessageResponse(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((ServerMessageResponseAssistantRequest) this.value); + } else if (this.type == 1) { + return visitor.visit((ServerMessageResponseToolCalls) this.value); + } else if (this.type == 2) { + return visitor.visit((ServerMessageResponseTransferDestinationRequest) this.value); + } else if (this.type == 3) { + return visitor.visit((ServerMessageResponseVoiceRequest) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageResponseMessageResponse + && equalTo((ServerMessageResponseMessageResponse) other); + } + + private boolean equalTo(ServerMessageResponseMessageResponse other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static ServerMessageResponseMessageResponse of(ServerMessageResponseAssistantRequest value) { + return new ServerMessageResponseMessageResponse(value, 0); + } + + public static ServerMessageResponseMessageResponse of(ServerMessageResponseToolCalls value) { + return new ServerMessageResponseMessageResponse(value, 1); + } + + public static ServerMessageResponseMessageResponse of(ServerMessageResponseTransferDestinationRequest value) { + return new ServerMessageResponseMessageResponse(value, 2); + } + + public static ServerMessageResponseMessageResponse of(ServerMessageResponseVoiceRequest value) { + return new ServerMessageResponseMessageResponse(value, 3); + } + + public interface Visitor { + T visit(ServerMessageResponseAssistantRequest value); + + T visit(ServerMessageResponseToolCalls value); + + T visit(ServerMessageResponseTransferDestinationRequest value); + + T visit(ServerMessageResponseVoiceRequest value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(ServerMessageResponseMessageResponse.class); + } + + @java.lang.Override + public ServerMessageResponseMessageResponse deserialize(JsonParser p, DeserializationContext ctxt) + throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ServerMessageResponseAssistantRequest.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ServerMessageResponseToolCalls.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue( + value, ServerMessageResponseTransferDestinationRequest.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ServerMessageResponseVoiceRequest.class)); + } catch (IllegalArgumentException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageResponseToolCalls.java b/src/main/java/com/vapi/api/types/ServerMessageResponseToolCalls.java new file mode 100644 index 0000000..1c287b4 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageResponseToolCalls.java @@ -0,0 +1,125 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageResponseToolCalls.Builder.class) +public final class ServerMessageResponseToolCalls { + private final Optional> results; + + private final Optional error; + + private final Map additionalProperties; + + private ServerMessageResponseToolCalls( + Optional> results, Optional error, Map additionalProperties) { + this.results = results; + this.error = error; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the results of the "tool-calls" message. + */ + @JsonProperty("results") + public Optional> getResults() { + return results; + } + + /** + * @return This is the error message if the tool call was not successful. + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageResponseToolCalls && equalTo((ServerMessageResponseToolCalls) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageResponseToolCalls other) { + return results.equals(other.results) && error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.results, this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> results = Optional.empty(); + + private Optional error = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ServerMessageResponseToolCalls other) { + results(other.getResults()); + error(other.getError()); + return this; + } + + @JsonSetter(value = "results", nulls = Nulls.SKIP) + public Builder results(Optional> results) { + this.results = results; + return this; + } + + public Builder results(List results) { + this.results = Optional.ofNullable(results); + return this; + } + + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public Builder error(Optional error) { + this.error = error; + return this; + } + + public Builder error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + public ServerMessageResponseToolCalls build() { + return new ServerMessageResponseToolCalls(results, error, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageResponseTransferDestinationRequest.java b/src/main/java/com/vapi/api/types/ServerMessageResponseTransferDestinationRequest.java new file mode 100644 index 0000000..bb04397 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageResponseTransferDestinationRequest.java @@ -0,0 +1,127 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageResponseTransferDestinationRequest.Builder.class) +public final class ServerMessageResponseTransferDestinationRequest { + private final Optional destination; + + private final Optional error; + + private final Map additionalProperties; + + private ServerMessageResponseTransferDestinationRequest( + Optional destination, + Optional error, + Map additionalProperties) { + this.destination = destination; + this.error = error; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the destination you'd like the call to be transferred to. + */ + @JsonProperty("destination") + public Optional getDestination() { + return destination; + } + + /** + * @return This is the error message if the transfer should not be made. + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageResponseTransferDestinationRequest + && equalTo((ServerMessageResponseTransferDestinationRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageResponseTransferDestinationRequest other) { + return destination.equals(other.destination) && error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.destination, this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional destination = Optional.empty(); + + private Optional error = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ServerMessageResponseTransferDestinationRequest other) { + destination(other.getDestination()); + error(other.getError()); + return this; + } + + @JsonSetter(value = "destination", nulls = Nulls.SKIP) + public Builder destination(Optional destination) { + this.destination = destination; + return this; + } + + public Builder destination(ServerMessageResponseTransferDestinationRequestDestination destination) { + this.destination = Optional.ofNullable(destination); + return this; + } + + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public Builder error(Optional error) { + this.error = error; + return this; + } + + public Builder error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + public ServerMessageResponseTransferDestinationRequest build() { + return new ServerMessageResponseTransferDestinationRequest(destination, error, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageResponseTransferDestinationRequestDestination.java b/src/main/java/com/vapi/api/types/ServerMessageResponseTransferDestinationRequestDestination.java new file mode 100644 index 0000000..e87cbf0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageResponseTransferDestinationRequestDestination.java @@ -0,0 +1,317 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageResponseTransferDestinationRequestDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageResponseTransferDestinationRequestDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageResponseTransferDestinationRequestDestination assistant( + TransferDestinationAssistant value) { + return new ServerMessageResponseTransferDestinationRequestDestination(new AssistantValue(value)); + } + + public static ServerMessageResponseTransferDestinationRequestDestination step(TransferDestinationStep value) { + return new ServerMessageResponseTransferDestinationRequestDestination(new StepValue(value)); + } + + public static ServerMessageResponseTransferDestinationRequestDestination number(TransferDestinationNumber value) { + return new ServerMessageResponseTransferDestinationRequestDestination(new NumberValue(value)); + } + + public static ServerMessageResponseTransferDestinationRequestDestination sip(TransferDestinationSip value) { + return new ServerMessageResponseTransferDestinationRequestDestination(new SipValue(value)); + } + + public boolean isAssistant() { + return value instanceof AssistantValue; + } + + public boolean isStep() { + return value instanceof StepValue; + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAssistant() { + if (isAssistant()) { + return Optional.of(((AssistantValue) value).value); + } + return Optional.empty(); + } + + public Optional getStep() { + if (isStep()) { + return Optional.of(((StepValue) value).value); + } + return Optional.empty(); + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAssistant(TransferDestinationAssistant assistant); + + T visitStep(TransferDestinationStep step); + + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AssistantValue.class), + @JsonSubTypes.Type(StepValue.class), + @JsonSubTypes.Type(NumberValue.class), + @JsonSubTypes.Type(SipValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("assistant") + private static final class AssistantValue implements Value { + @JsonUnwrapped + private TransferDestinationAssistant value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AssistantValue() {} + + private AssistantValue(TransferDestinationAssistant value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAssistant(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AssistantValue && equalTo((AssistantValue) other); + } + + private boolean equalTo(AssistantValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageResponseTransferDestinationRequestDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("step") + private static final class StepValue implements Value { + @JsonUnwrapped + private TransferDestinationStep value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private StepValue() {} + + private StepValue(TransferDestinationStep value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitStep(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StepValue && equalTo((StepValue) other); + } + + private boolean equalTo(StepValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageResponseTransferDestinationRequestDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageResponseTransferDestinationRequestDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageResponseTransferDestinationRequestDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageResponseTransferDestinationRequestDestination{" + "type: " + type + ", value: " + value + + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageResponseVoiceRequest.java b/src/main/java/com/vapi/api/types/ServerMessageResponseVoiceRequest.java new file mode 100644 index 0000000..6f17793 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageResponseVoiceRequest.java @@ -0,0 +1,141 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageResponseVoiceRequest.Builder.class) +public final class ServerMessageResponseVoiceRequest { + private final String data; + + private final Map additionalProperties; + + private ServerMessageResponseVoiceRequest(String data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + /** + * @return DO NOT respond to a voice-request webhook with this schema of { data }. This schema just exists to document what the response should look like. Follow these instructions: + *

Here is what the request will look like:

+ *

POST https://{assistant.voice.server.url} + * Content-Type: application/json

+ *

{ + * "messsage": { + * "type": "voice-request", + * "text": "Hello, world!", + * "sampleRate": 24000, + * ...other metadata about the call... + * } + * }

+ *

The expected response is 1-channel 16-bit raw PCM audio at the sample rate specified in the request. Here is how the response will be piped to the transport:

+ *
response.on('data', (chunk: Buffer) => {
+     *   outputStream.write(chunk);
+     * });
+     * 
+ */ + @JsonProperty("data") + public String getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageResponseVoiceRequest && equalTo((ServerMessageResponseVoiceRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageResponseVoiceRequest other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull String data); + + Builder from(ServerMessageResponseVoiceRequest other); + } + + public interface _FinalStage { + ServerMessageResponseVoiceRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private String data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ServerMessageResponseVoiceRequest other) { + data(other.getData()); + return this; + } + + /** + *

DO NOT respond to a voice-request webhook with this schema of { data }. This schema just exists to document what the response should look like. Follow these instructions:

+ *

Here is what the request will look like:

+ *

POST https://{assistant.voice.server.url} + * Content-Type: application/json

+ *

{ + * "messsage": { + * "type": "voice-request", + * "text": "Hello, world!", + * "sampleRate": 24000, + * ...other metadata about the call... + * } + * }

+ *

The expected response is 1-channel 16-bit raw PCM audio at the sample rate specified in the request. Here is how the response will be piped to the transport:

+ *
response.on('data', (chunk: Buffer) => {
+         *   outputStream.write(chunk);
+         * });
+         * 
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull String data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public ServerMessageResponseVoiceRequest build() { + return new ServerMessageResponseVoiceRequest(data, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageSpeechUpdate.java b/src/main/java/com/vapi/api/types/ServerMessageSpeechUpdate.java new file mode 100644 index 0000000..d61b66c --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageSpeechUpdate.java @@ -0,0 +1,419 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageSpeechUpdate.Builder.class) +public final class ServerMessageSpeechUpdate { + private final Optional phoneNumber; + + private final ServerMessageSpeechUpdateStatus status; + + private final ServerMessageSpeechUpdateRole role; + + private final Optional timestamp; + + private final Optional artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final Map additionalProperties; + + private ServerMessageSpeechUpdate( + Optional phoneNumber, + ServerMessageSpeechUpdateStatus status, + ServerMessageSpeechUpdateRole role, + Optional timestamp, + Optional artifact, + Optional assistant, + Optional customer, + Optional call, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.status = status; + this.role = role; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the status of the speech update. + */ + @JsonProperty("status") + public ServerMessageSpeechUpdateStatus getStatus() { + return status; + } + + /** + * @return This is the role which the speech update is for. + */ + @JsonProperty("role") + public ServerMessageSpeechUpdateRole getRole() { + return role; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return This is a live version of the call.artifact. + *

This matches what is stored on call.artifact after the call.

+ */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageSpeechUpdate && equalTo((ServerMessageSpeechUpdate) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageSpeechUpdate other) { + return phoneNumber.equals(other.phoneNumber) + && status.equals(other.status) + && role.equals(other.role) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.phoneNumber, + this.status, + this.role, + this.timestamp, + this.artifact, + this.assistant, + this.customer, + this.call); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StatusStage builder() { + return new Builder(); + } + + public interface StatusStage { + RoleStage status(@NotNull ServerMessageSpeechUpdateStatus status); + + Builder from(ServerMessageSpeechUpdate other); + } + + public interface RoleStage { + _FinalStage role(@NotNull ServerMessageSpeechUpdateRole role); + } + + public interface _FinalStage { + ServerMessageSpeechUpdate build(); + + _FinalStage phoneNumber(Optional phoneNumber); + + _FinalStage phoneNumber(ServerMessageSpeechUpdatePhoneNumber phoneNumber); + + _FinalStage timestamp(Optional timestamp); + + _FinalStage timestamp(String timestamp); + + _FinalStage artifact(Optional artifact); + + _FinalStage artifact(Artifact artifact); + + _FinalStage assistant(Optional assistant); + + _FinalStage assistant(CreateAssistantDto assistant); + + _FinalStage customer(Optional customer); + + _FinalStage customer(CreateCustomerDto customer); + + _FinalStage call(Optional call); + + _FinalStage call(Call call); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StatusStage, RoleStage, _FinalStage { + private ServerMessageSpeechUpdateStatus status; + + private ServerMessageSpeechUpdateRole role; + + private Optional call = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Optional phoneNumber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ServerMessageSpeechUpdate other) { + phoneNumber(other.getPhoneNumber()); + status(other.getStatus()); + role(other.getRole()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + return this; + } + + /** + *

This is the status of the speech update.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public RoleStage status(@NotNull ServerMessageSpeechUpdateStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

This is the role which the speech update is for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("role") + public _FinalStage role(@NotNull ServerMessageSpeechUpdateRole role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + /** + *

This is the call object.

+ *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + @java.lang.Override + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public _FinalStage call(Optional call) { + this.call = call; + return this; + } + + /** + *

This is the customer associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @java.lang.Override + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public _FinalStage customer(Optional customer) { + this.customer = customer; + return this; + } + + /** + *

This is the assistant that is currently active. This is provided for convenience.

+ *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public _FinalStage assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + /** + *

This is a live version of the call.artifact.

+ *

This matches what is stored on call.artifact after the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @java.lang.Override + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public _FinalStage artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + /** + *

This is the ISO-8601 formatted timestamp of when the message was sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @java.lang.Override + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public _FinalStage timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + *

This is the phone number associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneNumber(ServerMessageSpeechUpdatePhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public _FinalStage phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + @java.lang.Override + public ServerMessageSpeechUpdate build() { + return new ServerMessageSpeechUpdate( + phoneNumber, status, role, timestamp, artifact, assistant, customer, call, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageSpeechUpdatePhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessageSpeechUpdatePhoneNumber.java new file mode 100644 index 0000000..d8527cc --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageSpeechUpdatePhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageSpeechUpdatePhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageSpeechUpdatePhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageSpeechUpdatePhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessageSpeechUpdatePhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessageSpeechUpdatePhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessageSpeechUpdatePhoneNumber(new TwilioValue(value)); + } + + public static ServerMessageSpeechUpdatePhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessageSpeechUpdatePhoneNumber(new VonageValue(value)); + } + + public static ServerMessageSpeechUpdatePhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessageSpeechUpdatePhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageSpeechUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageSpeechUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageSpeechUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageSpeechUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageSpeechUpdatePhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageSpeechUpdateRole.java b/src/main/java/com/vapi/api/types/ServerMessageSpeechUpdateRole.java new file mode 100644 index 0000000..7725083 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageSpeechUpdateRole.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ServerMessageSpeechUpdateRole { + ASSISTANT("assistant"), + + USER("user"); + + private final String value; + + ServerMessageSpeechUpdateRole(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageSpeechUpdateStatus.java b/src/main/java/com/vapi/api/types/ServerMessageSpeechUpdateStatus.java new file mode 100644 index 0000000..05b2c35 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageSpeechUpdateStatus.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ServerMessageSpeechUpdateStatus { + STARTED("started"), + + STOPPED("stopped"); + + private final String value; + + ServerMessageSpeechUpdateStatus(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageStatusUpdate.java b/src/main/java/com/vapi/api/types/ServerMessageStatusUpdate.java new file mode 100644 index 0000000..5b97426 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageStatusUpdate.java @@ -0,0 +1,633 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageStatusUpdate.Builder.class) +public final class ServerMessageStatusUpdate { + private final Optional phoneNumber; + + private final ServerMessageStatusUpdateStatus status; + + private final Optional endedReason; + + private final Optional> messages; + + private final Optional> messagesOpenAiFormatted; + + private final Optional destination; + + private final Optional timestamp; + + private final Optional artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final Optional transcript; + + private final Optional> inboundPhoneCallDebuggingArtifacts; + + private final Map additionalProperties; + + private ServerMessageStatusUpdate( + Optional phoneNumber, + ServerMessageStatusUpdateStatus status, + Optional endedReason, + Optional> messages, + Optional> messagesOpenAiFormatted, + Optional destination, + Optional timestamp, + Optional artifact, + Optional assistant, + Optional customer, + Optional call, + Optional transcript, + Optional> inboundPhoneCallDebuggingArtifacts, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.status = status; + this.endedReason = endedReason; + this.messages = messages; + this.messagesOpenAiFormatted = messagesOpenAiFormatted; + this.destination = destination; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.transcript = transcript; + this.inboundPhoneCallDebuggingArtifacts = inboundPhoneCallDebuggingArtifacts; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the status of the call. + */ + @JsonProperty("status") + public ServerMessageStatusUpdateStatus getStatus() { + return status; + } + + /** + * @return This is the reason the call ended. This is only sent if the status is "ended". + */ + @JsonProperty("endedReason") + public Optional getEndedReason() { + return endedReason; + } + + /** + * @return These are the conversation messages of the call. This is only sent if the status is "forwarding". + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return These are the conversation messages of the call. This is only sent if the status is "forwarding". + */ + @JsonProperty("messagesOpenAIFormatted") + public Optional> getMessagesOpenAiFormatted() { + return messagesOpenAiFormatted; + } + + /** + * @return This is the destination the call is being transferred to. This is only sent if the status is "forwarding". + */ + @JsonProperty("destination") + public Optional getDestination() { + return destination; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return This is a live version of the call.artifact. + *

This matches what is stored on call.artifact after the call.

+ */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + /** + * @return This is the transcript of the call. This is only sent if the status is "forwarding". + */ + @JsonProperty("transcript") + public Optional getTranscript() { + return transcript; + } + + /** + * @return This is the inbound phone call debugging artifacts. This is only sent if the status is "ended" and there was an error accepting the inbound phone call. + *

This will include any errors related to the "assistant-request" if one was made.

+ */ + @JsonProperty("inboundPhoneCallDebuggingArtifacts") + public Optional> getInboundPhoneCallDebuggingArtifacts() { + return inboundPhoneCallDebuggingArtifacts; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageStatusUpdate && equalTo((ServerMessageStatusUpdate) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageStatusUpdate other) { + return phoneNumber.equals(other.phoneNumber) + && status.equals(other.status) + && endedReason.equals(other.endedReason) + && messages.equals(other.messages) + && messagesOpenAiFormatted.equals(other.messagesOpenAiFormatted) + && destination.equals(other.destination) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call) + && transcript.equals(other.transcript) + && inboundPhoneCallDebuggingArtifacts.equals(other.inboundPhoneCallDebuggingArtifacts); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.phoneNumber, + this.status, + this.endedReason, + this.messages, + this.messagesOpenAiFormatted, + this.destination, + this.timestamp, + this.artifact, + this.assistant, + this.customer, + this.call, + this.transcript, + this.inboundPhoneCallDebuggingArtifacts); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StatusStage builder() { + return new Builder(); + } + + public interface StatusStage { + _FinalStage status(@NotNull ServerMessageStatusUpdateStatus status); + + Builder from(ServerMessageStatusUpdate other); + } + + public interface _FinalStage { + ServerMessageStatusUpdate build(); + + _FinalStage phoneNumber(Optional phoneNumber); + + _FinalStage phoneNumber(ServerMessageStatusUpdatePhoneNumber phoneNumber); + + _FinalStage endedReason(Optional endedReason); + + _FinalStage endedReason(ServerMessageStatusUpdateEndedReason endedReason); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage messagesOpenAiFormatted(Optional> messagesOpenAiFormatted); + + _FinalStage messagesOpenAiFormatted(List messagesOpenAiFormatted); + + _FinalStage destination(Optional destination); + + _FinalStage destination(ServerMessageStatusUpdateDestination destination); + + _FinalStage timestamp(Optional timestamp); + + _FinalStage timestamp(String timestamp); + + _FinalStage artifact(Optional artifact); + + _FinalStage artifact(Artifact artifact); + + _FinalStage assistant(Optional assistant); + + _FinalStage assistant(CreateAssistantDto assistant); + + _FinalStage customer(Optional customer); + + _FinalStage customer(CreateCustomerDto customer); + + _FinalStage call(Optional call); + + _FinalStage call(Call call); + + _FinalStage transcript(Optional transcript); + + _FinalStage transcript(String transcript); + + _FinalStage inboundPhoneCallDebuggingArtifacts( + Optional> inboundPhoneCallDebuggingArtifacts); + + _FinalStage inboundPhoneCallDebuggingArtifacts(Map inboundPhoneCallDebuggingArtifacts); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StatusStage, _FinalStage { + private ServerMessageStatusUpdateStatus status; + + private Optional> inboundPhoneCallDebuggingArtifacts = Optional.empty(); + + private Optional transcript = Optional.empty(); + + private Optional call = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Optional destination = Optional.empty(); + + private Optional> messagesOpenAiFormatted = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional endedReason = Optional.empty(); + + private Optional phoneNumber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ServerMessageStatusUpdate other) { + phoneNumber(other.getPhoneNumber()); + status(other.getStatus()); + endedReason(other.getEndedReason()); + messages(other.getMessages()); + messagesOpenAiFormatted(other.getMessagesOpenAiFormatted()); + destination(other.getDestination()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + transcript(other.getTranscript()); + inboundPhoneCallDebuggingArtifacts(other.getInboundPhoneCallDebuggingArtifacts()); + return this; + } + + /** + *

This is the status of the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("status") + public _FinalStage status(@NotNull ServerMessageStatusUpdateStatus status) { + this.status = Objects.requireNonNull(status, "status must not be null"); + return this; + } + + /** + *

This is the inbound phone call debugging artifacts. This is only sent if the status is "ended" and there was an error accepting the inbound phone call.

+ *

This will include any errors related to the "assistant-request" if one was made.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage inboundPhoneCallDebuggingArtifacts(Map inboundPhoneCallDebuggingArtifacts) { + this.inboundPhoneCallDebuggingArtifacts = Optional.ofNullable(inboundPhoneCallDebuggingArtifacts); + return this; + } + + @java.lang.Override + @JsonSetter(value = "inboundPhoneCallDebuggingArtifacts", nulls = Nulls.SKIP) + public _FinalStage inboundPhoneCallDebuggingArtifacts( + Optional> inboundPhoneCallDebuggingArtifacts) { + this.inboundPhoneCallDebuggingArtifacts = inboundPhoneCallDebuggingArtifacts; + return this; + } + + /** + *

This is the transcript of the call. This is only sent if the status is "forwarding".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage transcript(String transcript) { + this.transcript = Optional.ofNullable(transcript); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transcript", nulls = Nulls.SKIP) + public _FinalStage transcript(Optional transcript) { + this.transcript = transcript; + return this; + } + + /** + *

This is the call object.

+ *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + @java.lang.Override + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public _FinalStage call(Optional call) { + this.call = call; + return this; + } + + /** + *

This is the customer associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @java.lang.Override + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public _FinalStage customer(Optional customer) { + this.customer = customer; + return this; + } + + /** + *

This is the assistant that is currently active. This is provided for convenience.

+ *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public _FinalStage assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + /** + *

This is a live version of the call.artifact.

+ *

This matches what is stored on call.artifact after the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @java.lang.Override + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public _FinalStage artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + /** + *

This is the ISO-8601 formatted timestamp of when the message was sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @java.lang.Override + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public _FinalStage timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + *

This is the destination the call is being transferred to. This is only sent if the status is "forwarding".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destination(ServerMessageStatusUpdateDestination destination) { + this.destination = Optional.ofNullable(destination); + return this; + } + + @java.lang.Override + @JsonSetter(value = "destination", nulls = Nulls.SKIP) + public _FinalStage destination(Optional destination) { + this.destination = destination; + return this; + } + + /** + *

These are the conversation messages of the call. This is only sent if the status is "forwarding".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messagesOpenAiFormatted(List messagesOpenAiFormatted) { + this.messagesOpenAiFormatted = Optional.ofNullable(messagesOpenAiFormatted); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messagesOpenAIFormatted", nulls = Nulls.SKIP) + public _FinalStage messagesOpenAiFormatted(Optional> messagesOpenAiFormatted) { + this.messagesOpenAiFormatted = messagesOpenAiFormatted; + return this; + } + + /** + *

These are the conversation messages of the call. This is only sent if the status is "forwarding".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + /** + *

This is the reason the call ended. This is only sent if the status is "ended".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endedReason(ServerMessageStatusUpdateEndedReason endedReason) { + this.endedReason = Optional.ofNullable(endedReason); + return this; + } + + @java.lang.Override + @JsonSetter(value = "endedReason", nulls = Nulls.SKIP) + public _FinalStage endedReason(Optional endedReason) { + this.endedReason = endedReason; + return this; + } + + /** + *

This is the phone number associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneNumber(ServerMessageStatusUpdatePhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public _FinalStage phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + @java.lang.Override + public ServerMessageStatusUpdate build() { + return new ServerMessageStatusUpdate( + phoneNumber, + status, + endedReason, + messages, + messagesOpenAiFormatted, + destination, + timestamp, + artifact, + assistant, + customer, + call, + transcript, + inboundPhoneCallDebuggingArtifacts, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageStatusUpdateDestination.java b/src/main/java/com/vapi/api/types/ServerMessageStatusUpdateDestination.java new file mode 100644 index 0000000..761b13a --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageStatusUpdateDestination.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageStatusUpdateDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageStatusUpdateDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageStatusUpdateDestination number(TransferDestinationNumber value) { + return new ServerMessageStatusUpdateDestination(new NumberValue(value)); + } + + public static ServerMessageStatusUpdateDestination sip(TransferDestinationSip value) { + return new ServerMessageStatusUpdateDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageStatusUpdateDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageStatusUpdateDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageStatusUpdateDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageStatusUpdateEndedReason.java b/src/main/java/com/vapi/api/types/ServerMessageStatusUpdateEndedReason.java new file mode 100644 index 0000000..f091666 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageStatusUpdateEndedReason.java @@ -0,0 +1,376 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ServerMessageStatusUpdateEndedReason { + ASSISTANT_ERROR("assistant-error"), + + ASSISTANT_NOT_FOUND("assistant-not-found"), + + DB_ERROR("db-error"), + + NO_SERVER_AVAILABLE("no-server-available"), + + LICENSE_CHECK_FAILED("license-check-failed"), + + PIPELINE_ERROR_OPENAI_LLM_FAILED("pipeline-error-openai-llm-failed"), + + PIPELINE_ERROR_AZURE_OPENAI_LLM_FAILED("pipeline-error-azure-openai-llm-failed"), + + PIPELINE_ERROR_GROQ_LLM_FAILED("pipeline-error-groq-llm-failed"), + + PIPELINE_ERROR_ANTHROPIC_LLM_FAILED("pipeline-error-anthropic-llm-failed"), + + PIPELINE_ERROR_VAPI_LLM_FAILED("pipeline-error-vapi-llm-failed"), + + PIPELINE_ERROR_VAPI_400_BAD_REQUEST_VALIDATION_FAILED("pipeline-error-vapi-400-bad-request-validation-failed"), + + PIPELINE_ERROR_VAPI_401_UNAUTHORIZED("pipeline-error-vapi-401-unauthorized"), + + PIPELINE_ERROR_VAPI_403_MODEL_ACCESS_DENIED("pipeline-error-vapi-403-model-access-denied"), + + PIPELINE_ERROR_VAPI_429_EXCEEDED_QUOTA("pipeline-error-vapi-429-exceeded-quota"), + + PIPELINE_ERROR_VAPI_500_SERVER_ERROR("pipeline-error-vapi-500-server-error"), + + PIPELINE_ERROR_OPENAI_VOICE_FAILED("pipeline-error-openai-voice-failed"), + + PIPELINE_ERROR_CARTESIA_VOICE_FAILED("pipeline-error-cartesia-voice-failed"), + + PIPELINE_ERROR_DEEPGRAM_TRANSCRIBER_FAILED("pipeline-error-deepgram-transcriber-failed"), + + PIPELINE_ERROR_DEEPGRAM_VOICE_FAILED("pipeline-error-deepgram-voice-failed"), + + PIPELINE_ERROR_GLADIA_TRANSCRIBER_FAILED("pipeline-error-gladia-transcriber-failed"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_FAILED("pipeline-error-eleven-labs-voice-failed"), + + PIPELINE_ERROR_PLAYHT_VOICE_FAILED("pipeline-error-playht-voice-failed"), + + PIPELINE_ERROR_LMNT_VOICE_FAILED("pipeline-error-lmnt-voice-failed"), + + PIPELINE_ERROR_AZURE_VOICE_FAILED("pipeline-error-azure-voice-failed"), + + PIPELINE_ERROR_RIME_AI_VOICE_FAILED("pipeline-error-rime-ai-voice-failed"), + + PIPELINE_ERROR_NEETS_VOICE_FAILED("pipeline-error-neets-voice-failed"), + + PIPELINE_NO_AVAILABLE_MODEL("pipeline-no-available-model"), + + WORKER_SHUTDOWN("worker-shutdown"), + + UNKNOWN_ERROR("unknown-error"), + + VONAGE_DISCONNECTED("vonage-disconnected"), + + VONAGE_FAILED_TO_CONNECT_CALL("vonage-failed-to-connect-call"), + + PHONE_CALL_PROVIDER_BYPASS_ENABLED_BUT_NO_CALL_RECEIVED("phone-call-provider-bypass-enabled-but-no-call-received"), + + VAPIFAULT_PHONE_CALL_WORKER_SETUP_SOCKET_ERROR("vapifault-phone-call-worker-setup-socket-error"), + + VAPIFAULT_PHONE_CALL_WORKER_WORKER_SETUP_SOCKET_TIMEOUT("vapifault-phone-call-worker-worker-setup-socket-timeout"), + + VAPIFAULT_PHONE_CALL_WORKER_COULD_NOT_FIND_CALL("vapifault-phone-call-worker-could-not-find-call"), + + VAPIFAULT_TRANSPORT_NEVER_CONNECTED("vapifault-transport-never-connected"), + + VAPIFAULT_WEB_CALL_WORKER_SETUP_FAILED("vapifault-web-call-worker-setup-failed"), + + VAPIFAULT_TRANSPORT_CONNECTED_BUT_CALL_NOT_ACTIVE("vapifault-transport-connected-but-call-not-active"), + + ASSISTANT_NOT_INVALID("assistant-not-invalid"), + + ASSISTANT_NOT_PROVIDED("assistant-not-provided"), + + CALL_START_ERROR_NEITHER_ASSISTANT_NOR_SERVER_SET("call-start-error-neither-assistant-nor-server-set"), + + ASSISTANT_REQUEST_FAILED("assistant-request-failed"), + + ASSISTANT_REQUEST_RETURNED_ERROR("assistant-request-returned-error"), + + ASSISTANT_REQUEST_RETURNED_UNSPEAKABLE_ERROR("assistant-request-returned-unspeakable-error"), + + ASSISTANT_REQUEST_RETURNED_INVALID_ASSISTANT("assistant-request-returned-invalid-assistant"), + + ASSISTANT_REQUEST_RETURNED_NO_ASSISTANT("assistant-request-returned-no-assistant"), + + ASSISTANT_REQUEST_RETURNED_FORWARDING_PHONE_NUMBER("assistant-request-returned-forwarding-phone-number"), + + ASSISTANT_ENDED_CALL("assistant-ended-call"), + + ASSISTANT_SAID_END_CALL_PHRASE("assistant-said-end-call-phrase"), + + ASSISTANT_FORWARDED_CALL("assistant-forwarded-call"), + + ASSISTANT_JOIN_TIMED_OUT("assistant-join-timed-out"), + + CUSTOMER_BUSY("customer-busy"), + + CUSTOMER_ENDED_CALL("customer-ended-call"), + + CUSTOMER_DID_NOT_ANSWER("customer-did-not-answer"), + + CUSTOMER_DID_NOT_GIVE_MICROPHONE_PERMISSION("customer-did-not-give-microphone-permission"), + + ASSISTANT_SAID_MESSAGE_WITH_END_CALL_ENABLED("assistant-said-message-with-end-call-enabled"), + + EXCEEDED_MAX_DURATION("exceeded-max-duration"), + + MANUALLY_CANCELED("manually-canceled"), + + PHONE_CALL_PROVIDER_CLOSED_WEBSOCKET("phone-call-provider-closed-websocket"), + + PIPELINE_ERROR_OPENAI_400_BAD_REQUEST_VALIDATION_FAILED("pipeline-error-openai-400-bad-request-validation-failed"), + + PIPELINE_ERROR_OPENAI_401_UNAUTHORIZED("pipeline-error-openai-401-unauthorized"), + + PIPELINE_ERROR_OPENAI_403_MODEL_ACCESS_DENIED("pipeline-error-openai-403-model-access-denied"), + + PIPELINE_ERROR_OPENAI_429_EXCEEDED_QUOTA("pipeline-error-openai-429-exceeded-quota"), + + PIPELINE_ERROR_OPENAI_500_SERVER_ERROR("pipeline-error-openai-500-server-error"), + + PIPELINE_ERROR_AZURE_OPENAI_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-azure-openai-400-bad-request-validation-failed"), + + PIPELINE_ERROR_AZURE_OPENAI_401_UNAUTHORIZED("pipeline-error-azure-openai-401-unauthorized"), + + PIPELINE_ERROR_AZURE_OPENAI_403_MODEL_ACCESS_DENIED("pipeline-error-azure-openai-403-model-access-denied"), + + PIPELINE_ERROR_AZURE_OPENAI_429_EXCEEDED_QUOTA("pipeline-error-azure-openai-429-exceeded-quota"), + + PIPELINE_ERROR_AZURE_OPENAI_500_SERVER_ERROR("pipeline-error-azure-openai-500-server-error"), + + PIPELINE_ERROR_GROQ_400_BAD_REQUEST_VALIDATION_FAILED("pipeline-error-groq-400-bad-request-validation-failed"), + + PIPELINE_ERROR_GROQ_401_UNAUTHORIZED("pipeline-error-groq-401-unauthorized"), + + PIPELINE_ERROR_GROQ_403_MODEL_ACCESS_DENIED("pipeline-error-groq-403-model-access-denied"), + + PIPELINE_ERROR_GROQ_429_EXCEEDED_QUOTA("pipeline-error-groq-429-exceeded-quota"), + + PIPELINE_ERROR_GROQ_500_SERVER_ERROR("pipeline-error-groq-500-server-error"), + + PIPELINE_ERROR_ANTHROPIC_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-anthropic-400-bad-request-validation-failed"), + + PIPELINE_ERROR_ANTHROPIC_401_UNAUTHORIZED("pipeline-error-anthropic-401-unauthorized"), + + PIPELINE_ERROR_ANTHROPIC_403_MODEL_ACCESS_DENIED("pipeline-error-anthropic-403-model-access-denied"), + + PIPELINE_ERROR_ANTHROPIC_429_EXCEEDED_QUOTA("pipeline-error-anthropic-429-exceeded-quota"), + + PIPELINE_ERROR_ANTHROPIC_500_SERVER_ERROR("pipeline-error-anthropic-500-server-error"), + + PIPELINE_ERROR_TOGETHER_AI_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-together-ai-400-bad-request-validation-failed"), + + PIPELINE_ERROR_TOGETHER_AI_401_UNAUTHORIZED("pipeline-error-together-ai-401-unauthorized"), + + PIPELINE_ERROR_TOGETHER_AI_403_MODEL_ACCESS_DENIED("pipeline-error-together-ai-403-model-access-denied"), + + PIPELINE_ERROR_TOGETHER_AI_429_EXCEEDED_QUOTA("pipeline-error-together-ai-429-exceeded-quota"), + + PIPELINE_ERROR_TOGETHER_AI_500_SERVER_ERROR("pipeline-error-together-ai-500-server-error"), + + PIPELINE_ERROR_TOGETHER_AI_LLM_FAILED("pipeline-error-together-ai-llm-failed"), + + PIPELINE_ERROR_ANYSCALE_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-anyscale-400-bad-request-validation-failed"), + + PIPELINE_ERROR_ANYSCALE_401_UNAUTHORIZED("pipeline-error-anyscale-401-unauthorized"), + + PIPELINE_ERROR_ANYSCALE_403_MODEL_ACCESS_DENIED("pipeline-error-anyscale-403-model-access-denied"), + + PIPELINE_ERROR_ANYSCALE_429_EXCEEDED_QUOTA("pipeline-error-anyscale-429-exceeded-quota"), + + PIPELINE_ERROR_ANYSCALE_500_SERVER_ERROR("pipeline-error-anyscale-500-server-error"), + + PIPELINE_ERROR_ANYSCALE_LLM_FAILED("pipeline-error-anyscale-llm-failed"), + + PIPELINE_ERROR_OPENROUTER_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-openrouter-400-bad-request-validation-failed"), + + PIPELINE_ERROR_OPENROUTER_401_UNAUTHORIZED("pipeline-error-openrouter-401-unauthorized"), + + PIPELINE_ERROR_OPENROUTER_403_MODEL_ACCESS_DENIED("pipeline-error-openrouter-403-model-access-denied"), + + PIPELINE_ERROR_OPENROUTER_429_EXCEEDED_QUOTA("pipeline-error-openrouter-429-exceeded-quota"), + + PIPELINE_ERROR_OPENROUTER_500_SERVER_ERROR("pipeline-error-openrouter-500-server-error"), + + PIPELINE_ERROR_OPENROUTER_LLM_FAILED("pipeline-error-openrouter-llm-failed"), + + PIPELINE_ERROR_PERPLEXITY_AI_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-perplexity-ai-400-bad-request-validation-failed"), + + PIPELINE_ERROR_PERPLEXITY_AI_401_UNAUTHORIZED("pipeline-error-perplexity-ai-401-unauthorized"), + + PIPELINE_ERROR_PERPLEXITY_AI_403_MODEL_ACCESS_DENIED("pipeline-error-perplexity-ai-403-model-access-denied"), + + PIPELINE_ERROR_PERPLEXITY_AI_429_EXCEEDED_QUOTA("pipeline-error-perplexity-ai-429-exceeded-quota"), + + PIPELINE_ERROR_PERPLEXITY_AI_500_SERVER_ERROR("pipeline-error-perplexity-ai-500-server-error"), + + PIPELINE_ERROR_PERPLEXITY_AI_LLM_FAILED("pipeline-error-perplexity-ai-llm-failed"), + + PIPELINE_ERROR_DEEPINFRA_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-deepinfra-400-bad-request-validation-failed"), + + PIPELINE_ERROR_DEEPINFRA_401_UNAUTHORIZED("pipeline-error-deepinfra-401-unauthorized"), + + PIPELINE_ERROR_DEEPINFRA_403_MODEL_ACCESS_DENIED("pipeline-error-deepinfra-403-model-access-denied"), + + PIPELINE_ERROR_DEEPINFRA_429_EXCEEDED_QUOTA("pipeline-error-deepinfra-429-exceeded-quota"), + + PIPELINE_ERROR_DEEPINFRA_500_SERVER_ERROR("pipeline-error-deepinfra-500-server-error"), + + PIPELINE_ERROR_DEEPINFRA_LLM_FAILED("pipeline-error-deepinfra-llm-failed"), + + PIPELINE_ERROR_RUNPOD_400_BAD_REQUEST_VALIDATION_FAILED("pipeline-error-runpod-400-bad-request-validation-failed"), + + PIPELINE_ERROR_RUNPOD_401_UNAUTHORIZED("pipeline-error-runpod-401-unauthorized"), + + PIPELINE_ERROR_RUNPOD_403_MODEL_ACCESS_DENIED("pipeline-error-runpod-403-model-access-denied"), + + PIPELINE_ERROR_RUNPOD_429_EXCEEDED_QUOTA("pipeline-error-runpod-429-exceeded-quota"), + + PIPELINE_ERROR_RUNPOD_500_SERVER_ERROR("pipeline-error-runpod-500-server-error"), + + PIPELINE_ERROR_RUNPOD_LLM_FAILED("pipeline-error-runpod-llm-failed"), + + PIPELINE_ERROR_CUSTOM_LLM_400_BAD_REQUEST_VALIDATION_FAILED( + "pipeline-error-custom-llm-400-bad-request-validation-failed"), + + PIPELINE_ERROR_CUSTOM_LLM_401_UNAUTHORIZED("pipeline-error-custom-llm-401-unauthorized"), + + PIPELINE_ERROR_CUSTOM_LLM_403_MODEL_ACCESS_DENIED("pipeline-error-custom-llm-403-model-access-denied"), + + PIPELINE_ERROR_CUSTOM_LLM_429_EXCEEDED_QUOTA("pipeline-error-custom-llm-429-exceeded-quota"), + + PIPELINE_ERROR_CUSTOM_LLM_500_SERVER_ERROR("pipeline-error-custom-llm-500-server-error"), + + PIPELINE_ERROR_CUSTOM_LLM_LLM_FAILED("pipeline-error-custom-llm-llm-failed"), + + PIPELINE_ERROR_CARTESIA_SOCKET_HANG_UP("pipeline-error-cartesia-socket-hang-up"), + + PIPELINE_ERROR_CARTESIA_REQUESTED_PAYMENT("pipeline-error-cartesia-requested-payment"), + + PIPELINE_ERROR_CARTESIA_500_SERVER_ERROR("pipeline-error-cartesia-500-server-error"), + + PIPELINE_ERROR_CARTESIA_503_SERVER_ERROR("pipeline-error-cartesia-503-server-error"), + + PIPELINE_ERROR_CARTESIA_522_SERVER_ERROR("pipeline-error-cartesia-522-server-error"), + + PIPELINE_ERROR_CUSTOM_VOICE_FAILED("pipeline-error-custom-voice-failed"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_FOUND("pipeline-error-eleven-labs-voice-not-found"), + + PIPELINE_ERROR_ELEVEN_LABS_QUOTA_EXCEEDED("pipeline-error-eleven-labs-quota-exceeded"), + + PIPELINE_ERROR_ELEVEN_LABS_UNAUTHORIZED_ACCESS("pipeline-error-eleven-labs-unauthorized-access"), + + PIPELINE_ERROR_ELEVEN_LABS_UNAUTHORIZED_TO_ACCESS_MODEL("pipeline-error-eleven-labs-unauthorized-to-access-model"), + + PIPELINE_ERROR_ELEVEN_LABS_PROFESSIONAL_VOICES_ONLY_FOR_CREATOR_PLUS( + "pipeline-error-eleven-labs-professional-voices-only-for-creator-plus"), + + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_FREE_PLAN_AND_REQUESTED_UPGRADE( + "pipeline-error-eleven-labs-blocked-free-plan-and-requested-upgrade"), + + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_CONCURRENT_REQUESTS_AND_REQUESTED_UPGRADE( + "pipeline-error-eleven-labs-blocked-concurrent-requests-and-requested-upgrade"), + + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_USING_INSTANT_VOICE_CLONE_AND_REQUESTED_UPGRADE( + "pipeline-error-eleven-labs-blocked-using-instant-voice-clone-and-requested-upgrade"), + + PIPELINE_ERROR_ELEVEN_LABS_SYSTEM_BUSY_AND_REQUESTED_UPGRADE( + "pipeline-error-eleven-labs-system-busy-and-requested-upgrade"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_FINE_TUNED("pipeline-error-eleven-labs-voice-not-fine-tuned"), + + PIPELINE_ERROR_ELEVEN_LABS_INVALID_API_KEY("pipeline-error-eleven-labs-invalid-api-key"), + + PIPELINE_ERROR_ELEVEN_LABS_INVALID_VOICE_SAMPLES("pipeline-error-eleven-labs-invalid-voice-samples"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_DISABLED_BY_OWNER("pipeline-error-eleven-labs-voice-disabled-by-owner"), + + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_ACCOUNT_IN_PROBATION("pipeline-error-eleven-labs-blocked-account-in-probation"), + + PIPELINE_ERROR_ELEVEN_LABS_BLOCKED_CONTENT_AGAINST_THEIR_POLICY( + "pipeline-error-eleven-labs-blocked-content-against-their-policy"), + + PIPELINE_ERROR_ELEVEN_LABS_MISSING_SAMPLES_FOR_VOICE_CLONE( + "pipeline-error-eleven-labs-missing-samples-for-voice-clone"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_FINE_TUNED_AND_CANNOT_BE_USED( + "pipeline-error-eleven-labs-voice-not-fine-tuned-and-cannot-be-used"), + + PIPELINE_ERROR_ELEVEN_LABS_VOICE_NOT_ALLOWED_FOR_FREE_USERS( + "pipeline-error-eleven-labs-voice-not-allowed-for-free-users"), + + PIPELINE_ERROR_ELEVEN_LABS_500_SERVER_ERROR("pipeline-error-eleven-labs-500-server-error"), + + PIPELINE_ERROR_ELEVEN_LABS_MAX_CHARACTER_LIMIT_EXCEEDED("pipeline-error-eleven-labs-max-character-limit-exceeded"), + + PIPELINE_ERROR_PLAYHT_REQUEST_TIMED_OUT("pipeline-error-playht-request-timed-out"), + + PIPELINE_ERROR_PLAYHT_INVALID_VOICE("pipeline-error-playht-invalid-voice"), + + PIPELINE_ERROR_PLAYHT_UNEXPECTED_ERROR("pipeline-error-playht-unexpected-error"), + + PIPELINE_ERROR_PLAYHT_OUT_OF_CREDITS("pipeline-error-playht-out-of-credits"), + + PIPELINE_ERROR_PLAYHT_VOICE_MUST_BE_A_VALID_VOICE_MANIFEST_URI( + "pipeline-error-playht-voice-must-be-a-valid-voice-manifest-uri"), + + PIPELINE_ERROR_PLAYHT_401_UNAUTHORIZED("pipeline-error-playht-401-unauthorized"), + + PIPELINE_ERROR_PLAYHT_403_FORBIDDEN_OUT_OF_CHARACTERS("pipeline-error-playht-403-forbidden-out-of-characters"), + + PIPELINE_ERROR_PLAYHT_403_FORBIDDEN_API_ACCESS_NOT_AVAILABLE( + "pipeline-error-playht-403-forbidden-api-access-not-available"), + + PIPELINE_ERROR_PLAYHT_429_EXCEEDED_QUOTA("pipeline-error-playht-429-exceeded-quota"), + + PIPELINE_ERROR_PLAYHT_502_GATEWAY_ERROR("pipeline-error-playht-502-gateway-error"), + + PIPELINE_ERROR_PLAYHT_504_GATEWAY_ERROR("pipeline-error-playht-504-gateway-error"), + + PIPELINE_ERROR_DEEPGRAM_403_MODEL_ACCESS_DENIED("pipeline-error-deepgram-403-model-access-denied"), + + PIPELINE_ERROR_DEEPGRAM_404_NOT_FOUND("pipeline-error-deepgram-404-not-found"), + + PIPELINE_ERROR_DEEPGRAM_400_NO_SUCH_MODEL_LANGUAGE_TIER_COMBINATION( + "pipeline-error-deepgram-400-no-such-model-language-tier-combination"), + + PIPELINE_ERROR_DEEPGRAM_500_RETURNING_INVALID_JSON("pipeline-error-deepgram-500-returning-invalid-json"), + + SIP_GATEWAY_FAILED_TO_CONNECT_CALL("sip-gateway-failed-to-connect-call"), + + SILENCE_TIMED_OUT("silence-timed-out"), + + TWILIO_FAILED_TO_CONNECT_CALL("twilio-failed-to-connect-call"), + + TWILIO_REPORTED_CUSTOMER_MISDIALED("twilio-reported-customer-misdialed"), + + VOICEMAIL("voicemail"), + + VONAGE_REJECTED("vonage-rejected"); + + private final String value; + + ServerMessageStatusUpdateEndedReason(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageStatusUpdateMessagesItem.java b/src/main/java/com/vapi/api/types/ServerMessageStatusUpdateMessagesItem.java new file mode 100644 index 0000000..f680e2d --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageStatusUpdateMessagesItem.java @@ -0,0 +1,132 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.vapi.api.core.ObjectMappers; +import java.io.IOException; +import java.util.Objects; + +@JsonDeserialize(using = ServerMessageStatusUpdateMessagesItem.Deserializer.class) +public final class ServerMessageStatusUpdateMessagesItem { + private final Object value; + + private final int type; + + private ServerMessageStatusUpdateMessagesItem(Object value, int type) { + this.value = value; + this.type = type; + } + + @JsonValue + public Object get() { + return this.value; + } + + public T visit(Visitor visitor) { + if (this.type == 0) { + return visitor.visit((UserMessage) this.value); + } else if (this.type == 1) { + return visitor.visit((SystemMessage) this.value); + } else if (this.type == 2) { + return visitor.visit((BotMessage) this.value); + } else if (this.type == 3) { + return visitor.visit((ToolCallMessage) this.value); + } else if (this.type == 4) { + return visitor.visit((ToolCallResultMessage) this.value); + } + throw new IllegalStateException("Failed to visit value. This should never happen."); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageStatusUpdateMessagesItem + && equalTo((ServerMessageStatusUpdateMessagesItem) other); + } + + private boolean equalTo(ServerMessageStatusUpdateMessagesItem other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return this.value.toString(); + } + + public static ServerMessageStatusUpdateMessagesItem of(UserMessage value) { + return new ServerMessageStatusUpdateMessagesItem(value, 0); + } + + public static ServerMessageStatusUpdateMessagesItem of(SystemMessage value) { + return new ServerMessageStatusUpdateMessagesItem(value, 1); + } + + public static ServerMessageStatusUpdateMessagesItem of(BotMessage value) { + return new ServerMessageStatusUpdateMessagesItem(value, 2); + } + + public static ServerMessageStatusUpdateMessagesItem of(ToolCallMessage value) { + return new ServerMessageStatusUpdateMessagesItem(value, 3); + } + + public static ServerMessageStatusUpdateMessagesItem of(ToolCallResultMessage value) { + return new ServerMessageStatusUpdateMessagesItem(value, 4); + } + + public interface Visitor { + T visit(UserMessage value); + + T visit(SystemMessage value); + + T visit(BotMessage value); + + T visit(ToolCallMessage value); + + T visit(ToolCallResultMessage value); + } + + static final class Deserializer extends StdDeserializer { + Deserializer() { + super(ServerMessageStatusUpdateMessagesItem.class); + } + + @java.lang.Override + public ServerMessageStatusUpdateMessagesItem deserialize(JsonParser p, DeserializationContext ctxt) + throws IOException { + Object value = p.readValueAs(Object.class); + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, UserMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, SystemMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, BotMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ToolCallMessage.class)); + } catch (IllegalArgumentException e) { + } + try { + return of(ObjectMappers.JSON_MAPPER.convertValue(value, ToolCallResultMessage.class)); + } catch (IllegalArgumentException e) { + } + throw new JsonParseException(p, "Failed to deserialize"); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageStatusUpdatePhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessageStatusUpdatePhoneNumber.java new file mode 100644 index 0000000..9b97cc9 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageStatusUpdatePhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageStatusUpdatePhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageStatusUpdatePhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageStatusUpdatePhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessageStatusUpdatePhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessageStatusUpdatePhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessageStatusUpdatePhoneNumber(new TwilioValue(value)); + } + + public static ServerMessageStatusUpdatePhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessageStatusUpdatePhoneNumber(new VonageValue(value)); + } + + public static ServerMessageStatusUpdatePhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessageStatusUpdatePhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageStatusUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageStatusUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageStatusUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageStatusUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageStatusUpdatePhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageStatusUpdateStatus.java b/src/main/java/com/vapi/api/types/ServerMessageStatusUpdateStatus.java new file mode 100644 index 0000000..9f5426f --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageStatusUpdateStatus.java @@ -0,0 +1,30 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ServerMessageStatusUpdateStatus { + QUEUED("queued"), + + RINGING("ringing"), + + IN_PROGRESS("in-progress"), + + FORWARDING("forwarding"), + + ENDED("ended"); + + private final String value; + + ServerMessageStatusUpdateStatus(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageToolCalls.java b/src/main/java/com/vapi/api/types/ServerMessageToolCalls.java new file mode 100644 index 0000000..4ef2b65 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageToolCalls.java @@ -0,0 +1,343 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageToolCalls.Builder.class) +public final class ServerMessageToolCalls { + private final Optional phoneNumber; + + private final List toolWithToolCallList; + + private final Optional timestamp; + + private final Optional artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final List toolCallList; + + private final Map additionalProperties; + + private ServerMessageToolCalls( + Optional phoneNumber, + List toolWithToolCallList, + Optional timestamp, + Optional artifact, + Optional assistant, + Optional customer, + Optional call, + List toolCallList, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.toolWithToolCallList = toolWithToolCallList; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.toolCallList = toolCallList; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the list of tools calls that the model is requesting along with the original tool configuration. + */ + @JsonProperty("toolWithToolCallList") + public List getToolWithToolCallList() { + return toolWithToolCallList; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return This is a live version of the call.artifact. + *

This matches what is stored on call.artifact after the call.

+ */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + /** + * @return This is the list of tool calls that the model is requesting. + */ + @JsonProperty("toolCallList") + public List getToolCallList() { + return toolCallList; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageToolCalls && equalTo((ServerMessageToolCalls) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageToolCalls other) { + return phoneNumber.equals(other.phoneNumber) + && toolWithToolCallList.equals(other.toolWithToolCallList) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call) + && toolCallList.equals(other.toolCallList); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.phoneNumber, + this.toolWithToolCallList, + this.timestamp, + this.artifact, + this.assistant, + this.customer, + this.call, + this.toolCallList); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional phoneNumber = Optional.empty(); + + private List toolWithToolCallList = new ArrayList<>(); + + private Optional timestamp = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional call = Optional.empty(); + + private List toolCallList = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ServerMessageToolCalls other) { + phoneNumber(other.getPhoneNumber()); + toolWithToolCallList(other.getToolWithToolCallList()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + toolCallList(other.getToolCallList()); + return this; + } + + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public Builder phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + public Builder phoneNumber(ServerMessageToolCallsPhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @JsonSetter(value = "toolWithToolCallList", nulls = Nulls.SKIP) + public Builder toolWithToolCallList(List toolWithToolCallList) { + this.toolWithToolCallList.clear(); + this.toolWithToolCallList.addAll(toolWithToolCallList); + return this; + } + + public Builder addToolWithToolCallList(ServerMessageToolCallsToolWithToolCallListItem toolWithToolCallList) { + this.toolWithToolCallList.add(toolWithToolCallList); + return this; + } + + public Builder addAllToolWithToolCallList( + List toolWithToolCallList) { + this.toolWithToolCallList.addAll(toolWithToolCallList); + return this; + } + + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public Builder timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + public Builder timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public Builder artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + public Builder artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public Builder assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + public Builder assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public Builder customer(Optional customer) { + this.customer = customer; + return this; + } + + public Builder customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public Builder call(Optional call) { + this.call = call; + return this; + } + + public Builder call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + @JsonSetter(value = "toolCallList", nulls = Nulls.SKIP) + public Builder toolCallList(List toolCallList) { + this.toolCallList.clear(); + this.toolCallList.addAll(toolCallList); + return this; + } + + public Builder addToolCallList(ToolCall toolCallList) { + this.toolCallList.add(toolCallList); + return this; + } + + public Builder addAllToolCallList(List toolCallList) { + this.toolCallList.addAll(toolCallList); + return this; + } + + public ServerMessageToolCalls build() { + return new ServerMessageToolCalls( + phoneNumber, + toolWithToolCallList, + timestamp, + artifact, + assistant, + customer, + call, + toolCallList, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageToolCallsPhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessageToolCallsPhoneNumber.java new file mode 100644 index 0000000..b335160 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageToolCallsPhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageToolCallsPhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageToolCallsPhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageToolCallsPhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessageToolCallsPhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessageToolCallsPhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessageToolCallsPhoneNumber(new TwilioValue(value)); + } + + public static ServerMessageToolCallsPhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessageToolCallsPhoneNumber(new VonageValue(value)); + } + + public static ServerMessageToolCallsPhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessageToolCallsPhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageToolCallsPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageToolCallsPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageToolCallsPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageToolCallsPhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageToolCallsPhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageToolCallsToolWithToolCallListItem.java b/src/main/java/com/vapi/api/types/ServerMessageToolCallsToolWithToolCallListItem.java new file mode 100644 index 0000000..fbf3f06 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageToolCallsToolWithToolCallListItem.java @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageToolCallsToolWithToolCallListItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageToolCallsToolWithToolCallListItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageToolCallsToolWithToolCallListItem function(FunctionToolWithToolCall value) { + return new ServerMessageToolCallsToolWithToolCallListItem(new FunctionValue(value)); + } + + public static ServerMessageToolCallsToolWithToolCallListItem ghl(GhlToolWithToolCall value) { + return new ServerMessageToolCallsToolWithToolCallListItem(new GhlValue(value)); + } + + public static ServerMessageToolCallsToolWithToolCallListItem make(MakeToolWithToolCall value) { + return new ServerMessageToolCallsToolWithToolCallListItem(new MakeValue(value)); + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitFunction(FunctionToolWithToolCall function); + + T visitGhl(GhlToolWithToolCall ghl); + + T visitMake(MakeToolWithToolCall make); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private FunctionToolWithToolCall value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(FunctionToolWithToolCall value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageToolCallsToolWithToolCallListItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private GhlToolWithToolCall value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(GhlToolWithToolCall value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageToolCallsToolWithToolCallListItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private MakeToolWithToolCall value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(MakeToolWithToolCall value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageToolCallsToolWithToolCallListItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageToolCallsToolWithToolCallListItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageTranscript.java b/src/main/java/com/vapi/api/types/ServerMessageTranscript.java new file mode 100644 index 0000000..732170c --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageTranscript.java @@ -0,0 +1,460 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageTranscript.Builder.class) +public final class ServerMessageTranscript { + private final Optional phoneNumber; + + private final Optional timestamp; + + private final Optional artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final ServerMessageTranscriptRole role; + + private final ServerMessageTranscriptTranscriptType transcriptType; + + private final String transcript; + + private final Map additionalProperties; + + private ServerMessageTranscript( + Optional phoneNumber, + Optional timestamp, + Optional artifact, + Optional assistant, + Optional customer, + Optional call, + ServerMessageTranscriptRole role, + ServerMessageTranscriptTranscriptType transcriptType, + String transcript, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.role = role; + this.transcriptType = transcriptType; + this.transcript = transcript; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return This is a live version of the call.artifact. + *

This matches what is stored on call.artifact after the call.

+ */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + /** + * @return This is the role for which the transcript is for. + */ + @JsonProperty("role") + public ServerMessageTranscriptRole getRole() { + return role; + } + + /** + * @return This is the type of the transcript. + */ + @JsonProperty("transcriptType") + public ServerMessageTranscriptTranscriptType getTranscriptType() { + return transcriptType; + } + + /** + * @return This is the transcript content. + */ + @JsonProperty("transcript") + public String getTranscript() { + return transcript; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageTranscript && equalTo((ServerMessageTranscript) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageTranscript other) { + return phoneNumber.equals(other.phoneNumber) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call) + && role.equals(other.role) + && transcriptType.equals(other.transcriptType) + && transcript.equals(other.transcript); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.phoneNumber, + this.timestamp, + this.artifact, + this.assistant, + this.customer, + this.call, + this.role, + this.transcriptType, + this.transcript); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RoleStage builder() { + return new Builder(); + } + + public interface RoleStage { + TranscriptTypeStage role(@NotNull ServerMessageTranscriptRole role); + + Builder from(ServerMessageTranscript other); + } + + public interface TranscriptTypeStage { + TranscriptStage transcriptType(@NotNull ServerMessageTranscriptTranscriptType transcriptType); + } + + public interface TranscriptStage { + _FinalStage transcript(@NotNull String transcript); + } + + public interface _FinalStage { + ServerMessageTranscript build(); + + _FinalStage phoneNumber(Optional phoneNumber); + + _FinalStage phoneNumber(ServerMessageTranscriptPhoneNumber phoneNumber); + + _FinalStage timestamp(Optional timestamp); + + _FinalStage timestamp(String timestamp); + + _FinalStage artifact(Optional artifact); + + _FinalStage artifact(Artifact artifact); + + _FinalStage assistant(Optional assistant); + + _FinalStage assistant(CreateAssistantDto assistant); + + _FinalStage customer(Optional customer); + + _FinalStage customer(CreateCustomerDto customer); + + _FinalStage call(Optional call); + + _FinalStage call(Call call); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RoleStage, TranscriptTypeStage, TranscriptStage, _FinalStage { + private ServerMessageTranscriptRole role; + + private ServerMessageTranscriptTranscriptType transcriptType; + + private String transcript; + + private Optional call = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Optional phoneNumber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ServerMessageTranscript other) { + phoneNumber(other.getPhoneNumber()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + role(other.getRole()); + transcriptType(other.getTranscriptType()); + transcript(other.getTranscript()); + return this; + } + + /** + *

This is the role for which the transcript is for.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("role") + public TranscriptTypeStage role(@NotNull ServerMessageTranscriptRole role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + /** + *

This is the type of the transcript.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("transcriptType") + public TranscriptStage transcriptType(@NotNull ServerMessageTranscriptTranscriptType transcriptType) { + this.transcriptType = Objects.requireNonNull(transcriptType, "transcriptType must not be null"); + return this; + } + + /** + *

This is the transcript content.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("transcript") + public _FinalStage transcript(@NotNull String transcript) { + this.transcript = Objects.requireNonNull(transcript, "transcript must not be null"); + return this; + } + + /** + *

This is the call object.

+ *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + @java.lang.Override + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public _FinalStage call(Optional call) { + this.call = call; + return this; + } + + /** + *

This is the customer associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @java.lang.Override + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public _FinalStage customer(Optional customer) { + this.customer = customer; + return this; + } + + /** + *

This is the assistant that is currently active. This is provided for convenience.

+ *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public _FinalStage assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + /** + *

This is a live version of the call.artifact.

+ *

This matches what is stored on call.artifact after the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @java.lang.Override + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public _FinalStage artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + /** + *

This is the ISO-8601 formatted timestamp of when the message was sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @java.lang.Override + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public _FinalStage timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + *

This is the phone number associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneNumber(ServerMessageTranscriptPhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public _FinalStage phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + @java.lang.Override + public ServerMessageTranscript build() { + return new ServerMessageTranscript( + phoneNumber, + timestamp, + artifact, + assistant, + customer, + call, + role, + transcriptType, + transcript, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageTranscriptPhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessageTranscriptPhoneNumber.java new file mode 100644 index 0000000..7ae24c7 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageTranscriptPhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageTranscriptPhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageTranscriptPhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageTranscriptPhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessageTranscriptPhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessageTranscriptPhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessageTranscriptPhoneNumber(new TwilioValue(value)); + } + + public static ServerMessageTranscriptPhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessageTranscriptPhoneNumber(new VonageValue(value)); + } + + public static ServerMessageTranscriptPhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessageTranscriptPhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTranscriptPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTranscriptPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTranscriptPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTranscriptPhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTranscriptPhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageTranscriptRole.java b/src/main/java/com/vapi/api/types/ServerMessageTranscriptRole.java new file mode 100644 index 0000000..4839a7f --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageTranscriptRole.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ServerMessageTranscriptRole { + ASSISTANT("assistant"), + + USER("user"); + + private final String value; + + ServerMessageTranscriptRole(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageTranscriptTranscriptType.java b/src/main/java/com/vapi/api/types/ServerMessageTranscriptTranscriptType.java new file mode 100644 index 0000000..644cd4e --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageTranscriptTranscriptType.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ServerMessageTranscriptTranscriptType { + PARTIAL("partial"), + + FINAL("final"); + + private final String value; + + ServerMessageTranscriptTranscriptType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageTransferDestinationRequest.java b/src/main/java/com/vapi/api/types/ServerMessageTransferDestinationRequest.java new file mode 100644 index 0000000..dcc8a1c --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageTransferDestinationRequest.java @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageTransferDestinationRequest.Builder.class) +public final class ServerMessageTransferDestinationRequest { + private final Optional phoneNumber; + + private final Optional timestamp; + + private final Optional artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final Map additionalProperties; + + private ServerMessageTransferDestinationRequest( + Optional phoneNumber, + Optional timestamp, + Optional artifact, + Optional assistant, + Optional customer, + Optional call, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return This is a live version of the call.artifact. + *

This matches what is stored on call.artifact after the call.

+ */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageTransferDestinationRequest + && equalTo((ServerMessageTransferDestinationRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageTransferDestinationRequest other) { + return phoneNumber.equals(other.phoneNumber) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.phoneNumber, this.timestamp, this.artifact, this.assistant, this.customer, this.call); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional phoneNumber = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional call = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ServerMessageTransferDestinationRequest other) { + phoneNumber(other.getPhoneNumber()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + return this; + } + + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public Builder phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + public Builder phoneNumber(ServerMessageTransferDestinationRequestPhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public Builder timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + public Builder timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public Builder artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + public Builder artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public Builder assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + public Builder assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public Builder customer(Optional customer) { + this.customer = customer; + return this; + } + + public Builder customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public Builder call(Optional call) { + this.call = call; + return this; + } + + public Builder call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + public ServerMessageTransferDestinationRequest build() { + return new ServerMessageTransferDestinationRequest( + phoneNumber, timestamp, artifact, assistant, customer, call, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageTransferDestinationRequestPhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessageTransferDestinationRequestPhoneNumber.java new file mode 100644 index 0000000..71610e6 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageTransferDestinationRequestPhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageTransferDestinationRequestPhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageTransferDestinationRequestPhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageTransferDestinationRequestPhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessageTransferDestinationRequestPhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessageTransferDestinationRequestPhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessageTransferDestinationRequestPhoneNumber(new TwilioValue(value)); + } + + public static ServerMessageTransferDestinationRequestPhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessageTransferDestinationRequestPhoneNumber(new VonageValue(value)); + } + + public static ServerMessageTransferDestinationRequestPhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessageTransferDestinationRequestPhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTransferDestinationRequestPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTransferDestinationRequestPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTransferDestinationRequestPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTransferDestinationRequestPhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTransferDestinationRequestPhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageTransferUpdate.java b/src/main/java/com/vapi/api/types/ServerMessageTransferUpdate.java new file mode 100644 index 0000000..54ba6fd --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageTransferUpdate.java @@ -0,0 +1,357 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageTransferUpdate.Builder.class) +public final class ServerMessageTransferUpdate { + private final Optional phoneNumber; + + private final Optional destination; + + private final Optional timestamp; + + private final Optional artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final Optional toAssistant; + + private final Optional fromAssistant; + + private final Map additionalProperties; + + private ServerMessageTransferUpdate( + Optional phoneNumber, + Optional destination, + Optional timestamp, + Optional artifact, + Optional assistant, + Optional customer, + Optional call, + Optional toAssistant, + Optional fromAssistant, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.destination = destination; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.toAssistant = toAssistant; + this.fromAssistant = fromAssistant; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the destination of the transfer. + */ + @JsonProperty("destination") + public Optional getDestination() { + return destination; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return This is a live version of the call.artifact. + *

This matches what is stored on call.artifact after the call.

+ */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + /** + * @return This is the assistant that the call is being transferred to. This is only sent if destination.type is "assistant". + */ + @JsonProperty("toAssistant") + public Optional getToAssistant() { + return toAssistant; + } + + /** + * @return This is the assistant that the call is being transferred from. This is only sent if destination.type is "assistant". + */ + @JsonProperty("fromAssistant") + public Optional getFromAssistant() { + return fromAssistant; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageTransferUpdate && equalTo((ServerMessageTransferUpdate) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageTransferUpdate other) { + return phoneNumber.equals(other.phoneNumber) + && destination.equals(other.destination) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call) + && toAssistant.equals(other.toAssistant) + && fromAssistant.equals(other.fromAssistant); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.phoneNumber, + this.destination, + this.timestamp, + this.artifact, + this.assistant, + this.customer, + this.call, + this.toAssistant, + this.fromAssistant); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional phoneNumber = Optional.empty(); + + private Optional destination = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional call = Optional.empty(); + + private Optional toAssistant = Optional.empty(); + + private Optional fromAssistant = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ServerMessageTransferUpdate other) { + phoneNumber(other.getPhoneNumber()); + destination(other.getDestination()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + toAssistant(other.getToAssistant()); + fromAssistant(other.getFromAssistant()); + return this; + } + + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public Builder phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + public Builder phoneNumber(ServerMessageTransferUpdatePhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @JsonSetter(value = "destination", nulls = Nulls.SKIP) + public Builder destination(Optional destination) { + this.destination = destination; + return this; + } + + public Builder destination(ServerMessageTransferUpdateDestination destination) { + this.destination = Optional.ofNullable(destination); + return this; + } + + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public Builder timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + public Builder timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public Builder artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + public Builder artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public Builder assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + public Builder assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public Builder customer(Optional customer) { + this.customer = customer; + return this; + } + + public Builder customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public Builder call(Optional call) { + this.call = call; + return this; + } + + public Builder call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + @JsonSetter(value = "toAssistant", nulls = Nulls.SKIP) + public Builder toAssistant(Optional toAssistant) { + this.toAssistant = toAssistant; + return this; + } + + public Builder toAssistant(CreateAssistantDto toAssistant) { + this.toAssistant = Optional.ofNullable(toAssistant); + return this; + } + + @JsonSetter(value = "fromAssistant", nulls = Nulls.SKIP) + public Builder fromAssistant(Optional fromAssistant) { + this.fromAssistant = fromAssistant; + return this; + } + + public Builder fromAssistant(CreateAssistantDto fromAssistant) { + this.fromAssistant = Optional.ofNullable(fromAssistant); + return this; + } + + public ServerMessageTransferUpdate build() { + return new ServerMessageTransferUpdate( + phoneNumber, + destination, + timestamp, + artifact, + assistant, + customer, + call, + toAssistant, + fromAssistant, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageTransferUpdateDestination.java b/src/main/java/com/vapi/api/types/ServerMessageTransferUpdateDestination.java new file mode 100644 index 0000000..97e5cad --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageTransferUpdateDestination.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageTransferUpdateDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageTransferUpdateDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageTransferUpdateDestination assistant(TransferDestinationAssistant value) { + return new ServerMessageTransferUpdateDestination(new AssistantValue(value)); + } + + public static ServerMessageTransferUpdateDestination step(TransferDestinationStep value) { + return new ServerMessageTransferUpdateDestination(new StepValue(value)); + } + + public static ServerMessageTransferUpdateDestination number(TransferDestinationNumber value) { + return new ServerMessageTransferUpdateDestination(new NumberValue(value)); + } + + public static ServerMessageTransferUpdateDestination sip(TransferDestinationSip value) { + return new ServerMessageTransferUpdateDestination(new SipValue(value)); + } + + public boolean isAssistant() { + return value instanceof AssistantValue; + } + + public boolean isStep() { + return value instanceof StepValue; + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAssistant() { + if (isAssistant()) { + return Optional.of(((AssistantValue) value).value); + } + return Optional.empty(); + } + + public Optional getStep() { + if (isStep()) { + return Optional.of(((StepValue) value).value); + } + return Optional.empty(); + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAssistant(TransferDestinationAssistant assistant); + + T visitStep(TransferDestinationStep step); + + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AssistantValue.class), + @JsonSubTypes.Type(StepValue.class), + @JsonSubTypes.Type(NumberValue.class), + @JsonSubTypes.Type(SipValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("assistant") + private static final class AssistantValue implements Value { + @JsonUnwrapped + private TransferDestinationAssistant value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AssistantValue() {} + + private AssistantValue(TransferDestinationAssistant value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAssistant(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AssistantValue && equalTo((AssistantValue) other); + } + + private boolean equalTo(AssistantValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTransferUpdateDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("step") + private static final class StepValue implements Value { + @JsonUnwrapped + private TransferDestinationStep value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private StepValue() {} + + private StepValue(TransferDestinationStep value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitStep(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StepValue && equalTo((StepValue) other); + } + + private boolean equalTo(StepValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTransferUpdateDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTransferUpdateDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTransferUpdateDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTransferUpdateDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageTransferUpdatePhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessageTransferUpdatePhoneNumber.java new file mode 100644 index 0000000..278e7cb --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageTransferUpdatePhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageTransferUpdatePhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageTransferUpdatePhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageTransferUpdatePhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessageTransferUpdatePhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessageTransferUpdatePhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessageTransferUpdatePhoneNumber(new TwilioValue(value)); + } + + public static ServerMessageTransferUpdatePhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessageTransferUpdatePhoneNumber(new VonageValue(value)); + } + + public static ServerMessageTransferUpdatePhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessageTransferUpdatePhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTransferUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTransferUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTransferUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTransferUpdatePhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageTransferUpdatePhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageUserInterrupted.java b/src/main/java/com/vapi/api/types/ServerMessageUserInterrupted.java new file mode 100644 index 0000000..04d4591 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageUserInterrupted.java @@ -0,0 +1,258 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageUserInterrupted.Builder.class) +public final class ServerMessageUserInterrupted { + private final Optional phoneNumber; + + private final Optional timestamp; + + private final Optional artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final Map additionalProperties; + + private ServerMessageUserInterrupted( + Optional phoneNumber, + Optional timestamp, + Optional artifact, + Optional assistant, + Optional customer, + Optional call, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return This is a live version of the call.artifact. + *

This matches what is stored on call.artifact after the call.

+ */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageUserInterrupted && equalTo((ServerMessageUserInterrupted) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageUserInterrupted other) { + return phoneNumber.equals(other.phoneNumber) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.phoneNumber, this.timestamp, this.artifact, this.assistant, this.customer, this.call); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional phoneNumber = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional call = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ServerMessageUserInterrupted other) { + phoneNumber(other.getPhoneNumber()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + return this; + } + + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public Builder phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + public Builder phoneNumber(ServerMessageUserInterruptedPhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public Builder timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + public Builder timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public Builder artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + public Builder artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public Builder assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + public Builder assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public Builder customer(Optional customer) { + this.customer = customer; + return this; + } + + public Builder customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public Builder call(Optional call) { + this.call = call; + return this; + } + + public Builder call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + public ServerMessageUserInterrupted build() { + return new ServerMessageUserInterrupted( + phoneNumber, timestamp, artifact, assistant, customer, call, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageUserInterruptedPhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessageUserInterruptedPhoneNumber.java new file mode 100644 index 0000000..bf121ef --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageUserInterruptedPhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageUserInterruptedPhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageUserInterruptedPhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageUserInterruptedPhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessageUserInterruptedPhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessageUserInterruptedPhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessageUserInterruptedPhoneNumber(new TwilioValue(value)); + } + + public static ServerMessageUserInterruptedPhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessageUserInterruptedPhoneNumber(new VonageValue(value)); + } + + public static ServerMessageUserInterruptedPhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessageUserInterruptedPhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageUserInterruptedPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageUserInterruptedPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageUserInterruptedPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageUserInterruptedPhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageUserInterruptedPhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageVoiceInput.java b/src/main/java/com/vapi/api/types/ServerMessageVoiceInput.java new file mode 100644 index 0000000..d851921 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageVoiceInput.java @@ -0,0 +1,381 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageVoiceInput.Builder.class) +public final class ServerMessageVoiceInput { + private final Optional phoneNumber; + + private final Optional timestamp; + + private final Optional artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final String input; + + private final Map additionalProperties; + + private ServerMessageVoiceInput( + Optional phoneNumber, + Optional timestamp, + Optional artifact, + Optional assistant, + Optional customer, + Optional call, + String input, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.input = input; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return This is a live version of the call.artifact. + *

This matches what is stored on call.artifact after the call.

+ */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + /** + * @return This is the voice input content + */ + @JsonProperty("input") + public String getInput() { + return input; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageVoiceInput && equalTo((ServerMessageVoiceInput) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageVoiceInput other) { + return phoneNumber.equals(other.phoneNumber) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call) + && input.equals(other.input); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.phoneNumber, this.timestamp, this.artifact, this.assistant, this.customer, this.call, this.input); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static InputStage builder() { + return new Builder(); + } + + public interface InputStage { + _FinalStage input(@NotNull String input); + + Builder from(ServerMessageVoiceInput other); + } + + public interface _FinalStage { + ServerMessageVoiceInput build(); + + _FinalStage phoneNumber(Optional phoneNumber); + + _FinalStage phoneNumber(ServerMessageVoiceInputPhoneNumber phoneNumber); + + _FinalStage timestamp(Optional timestamp); + + _FinalStage timestamp(String timestamp); + + _FinalStage artifact(Optional artifact); + + _FinalStage artifact(Artifact artifact); + + _FinalStage assistant(Optional assistant); + + _FinalStage assistant(CreateAssistantDto assistant); + + _FinalStage customer(Optional customer); + + _FinalStage customer(CreateCustomerDto customer); + + _FinalStage call(Optional call); + + _FinalStage call(Call call); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements InputStage, _FinalStage { + private String input; + + private Optional call = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Optional phoneNumber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ServerMessageVoiceInput other) { + phoneNumber(other.getPhoneNumber()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + input(other.getInput()); + return this; + } + + /** + *

This is the voice input content

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("input") + public _FinalStage input(@NotNull String input) { + this.input = Objects.requireNonNull(input, "input must not be null"); + return this; + } + + /** + *

This is the call object.

+ *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + @java.lang.Override + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public _FinalStage call(Optional call) { + this.call = call; + return this; + } + + /** + *

This is the customer associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @java.lang.Override + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public _FinalStage customer(Optional customer) { + this.customer = customer; + return this; + } + + /** + *

This is the assistant that is currently active. This is provided for convenience.

+ *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public _FinalStage assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + /** + *

This is a live version of the call.artifact.

+ *

This matches what is stored on call.artifact after the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @java.lang.Override + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public _FinalStage artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + /** + *

This is the ISO-8601 formatted timestamp of when the message was sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @java.lang.Override + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public _FinalStage timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + *

This is the phone number associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneNumber(ServerMessageVoiceInputPhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public _FinalStage phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + @java.lang.Override + public ServerMessageVoiceInput build() { + return new ServerMessageVoiceInput( + phoneNumber, timestamp, artifact, assistant, customer, call, input, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageVoiceInputPhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessageVoiceInputPhoneNumber.java new file mode 100644 index 0000000..4969d4d --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageVoiceInputPhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageVoiceInputPhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageVoiceInputPhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageVoiceInputPhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessageVoiceInputPhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessageVoiceInputPhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessageVoiceInputPhoneNumber(new TwilioValue(value)); + } + + public static ServerMessageVoiceInputPhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessageVoiceInputPhoneNumber(new VonageValue(value)); + } + + public static ServerMessageVoiceInputPhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessageVoiceInputPhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageVoiceInputPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageVoiceInputPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageVoiceInputPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageVoiceInputPhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageVoiceInputPhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageVoiceRequest.java b/src/main/java/com/vapi/api/types/ServerMessageVoiceRequest.java new file mode 100644 index 0000000..dc69261 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageVoiceRequest.java @@ -0,0 +1,427 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ServerMessageVoiceRequest.Builder.class) +public final class ServerMessageVoiceRequest { + private final Optional phoneNumber; + + private final Optional timestamp; + + private final Optional artifact; + + private final Optional assistant; + + private final Optional customer; + + private final Optional call; + + private final String text; + + private final double sampleRate; + + private final Map additionalProperties; + + private ServerMessageVoiceRequest( + Optional phoneNumber, + Optional timestamp, + Optional artifact, + Optional assistant, + Optional customer, + Optional call, + String text, + double sampleRate, + Map additionalProperties) { + this.phoneNumber = phoneNumber; + this.timestamp = timestamp; + this.artifact = artifact; + this.assistant = assistant; + this.customer = customer; + this.call = call; + this.text = text; + this.sampleRate = sampleRate; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the phone number associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ */ + @JsonProperty("phoneNumber") + public Optional getPhoneNumber() { + return phoneNumber; + } + + /** + * @return This is the ISO-8601 formatted timestamp of when the message was sent. + */ + @JsonProperty("timestamp") + public Optional getTimestamp() { + return timestamp; + } + + /** + * @return This is a live version of the call.artifact. + *

This matches what is stored on call.artifact after the call.

+ */ + @JsonProperty("artifact") + public Optional getArtifact() { + return artifact; + } + + /** + * @return This is the assistant that is currently active. This is provided for convenience. + *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This is the customer associated with the call. + *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ */ + @JsonProperty("customer") + public Optional getCustomer() { + return customer; + } + + /** + * @return This is the call object. + *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ */ + @JsonProperty("call") + public Optional getCall() { + return call; + } + + /** + * @return This is the text to be synthesized. + */ + @JsonProperty("text") + public String getText() { + return text; + } + + /** + * @return This is the sample rate to be synthesized. + */ + @JsonProperty("sampleRate") + public double getSampleRate() { + return sampleRate; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ServerMessageVoiceRequest && equalTo((ServerMessageVoiceRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ServerMessageVoiceRequest other) { + return phoneNumber.equals(other.phoneNumber) + && timestamp.equals(other.timestamp) + && artifact.equals(other.artifact) + && assistant.equals(other.assistant) + && customer.equals(other.customer) + && call.equals(other.call) + && text.equals(other.text) + && sampleRate == other.sampleRate; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.phoneNumber, + this.timestamp, + this.artifact, + this.assistant, + this.customer, + this.call, + this.text, + this.sampleRate); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TextStage builder() { + return new Builder(); + } + + public interface TextStage { + SampleRateStage text(@NotNull String text); + + Builder from(ServerMessageVoiceRequest other); + } + + public interface SampleRateStage { + _FinalStage sampleRate(double sampleRate); + } + + public interface _FinalStage { + ServerMessageVoiceRequest build(); + + _FinalStage phoneNumber(Optional phoneNumber); + + _FinalStage phoneNumber(ServerMessageVoiceRequestPhoneNumber phoneNumber); + + _FinalStage timestamp(Optional timestamp); + + _FinalStage timestamp(String timestamp); + + _FinalStage artifact(Optional artifact); + + _FinalStage artifact(Artifact artifact); + + _FinalStage assistant(Optional assistant); + + _FinalStage assistant(CreateAssistantDto assistant); + + _FinalStage customer(Optional customer); + + _FinalStage customer(CreateCustomerDto customer); + + _FinalStage call(Optional call); + + _FinalStage call(Call call); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TextStage, SampleRateStage, _FinalStage { + private String text; + + private double sampleRate; + + private Optional call = Optional.empty(); + + private Optional customer = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional artifact = Optional.empty(); + + private Optional timestamp = Optional.empty(); + + private Optional phoneNumber = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ServerMessageVoiceRequest other) { + phoneNumber(other.getPhoneNumber()); + timestamp(other.getTimestamp()); + artifact(other.getArtifact()); + assistant(other.getAssistant()); + customer(other.getCustomer()); + call(other.getCall()); + text(other.getText()); + sampleRate(other.getSampleRate()); + return this; + } + + /** + *

This is the text to be synthesized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("text") + public SampleRateStage text(@NotNull String text) { + this.text = Objects.requireNonNull(text, "text must not be null"); + return this; + } + + /** + *

This is the sample rate to be synthesized.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sampleRate") + public _FinalStage sampleRate(double sampleRate) { + this.sampleRate = sampleRate; + return this; + } + + /** + *

This is the call object.

+ *

This matches what was returned in POST /call.

+ *

Note: This might get stale during the call. To get the latest call object, especially after the call is ended, use GET /call/:id.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage call(Call call) { + this.call = Optional.ofNullable(call); + return this; + } + + @java.lang.Override + @JsonSetter(value = "call", nulls = Nulls.SKIP) + public _FinalStage call(Optional call) { + this.call = call; + return this; + } + + /** + *

This is the customer associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.customer,
  • + *
  • call.customerId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customer(CreateCustomerDto customer) { + this.customer = Optional.ofNullable(customer); + return this; + } + + @java.lang.Override + @JsonSetter(value = "customer", nulls = Nulls.SKIP) + public _FinalStage customer(Optional customer) { + this.customer = customer; + return this; + } + + /** + *

This is the assistant that is currently active. This is provided for convenience.

+ *

This matches one of the following:

+ *
    + *
  • call.assistant,
  • + *
  • call.assistantId,
  • + *
  • call.squad[n].assistant,
  • + *
  • call.squad[n].assistantId,
  • + *
  • call.squadId->[n].assistant,
  • + *
  • call.squadId->[n].assistantId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public _FinalStage assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + /** + *

This is a live version of the call.artifact.

+ *

This matches what is stored on call.artifact after the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage artifact(Artifact artifact) { + this.artifact = Optional.ofNullable(artifact); + return this; + } + + @java.lang.Override + @JsonSetter(value = "artifact", nulls = Nulls.SKIP) + public _FinalStage artifact(Optional artifact) { + this.artifact = artifact; + return this; + } + + /** + *

This is the ISO-8601 formatted timestamp of when the message was sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timestamp(String timestamp) { + this.timestamp = Optional.ofNullable(timestamp); + return this; + } + + @java.lang.Override + @JsonSetter(value = "timestamp", nulls = Nulls.SKIP) + public _FinalStage timestamp(Optional timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + *

This is the phone number associated with the call.

+ *

This matches one of the following:

+ *
    + *
  • call.phoneNumber,
  • + *
  • call.phoneNumberId.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage phoneNumber(ServerMessageVoiceRequestPhoneNumber phoneNumber) { + this.phoneNumber = Optional.ofNullable(phoneNumber); + return this; + } + + @java.lang.Override + @JsonSetter(value = "phoneNumber", nulls = Nulls.SKIP) + public _FinalStage phoneNumber(Optional phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + @java.lang.Override + public ServerMessageVoiceRequest build() { + return new ServerMessageVoiceRequest( + phoneNumber, + timestamp, + artifact, + assistant, + customer, + call, + text, + sampleRate, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ServerMessageVoiceRequestPhoneNumber.java b/src/main/java/com/vapi/api/types/ServerMessageVoiceRequestPhoneNumber.java new file mode 100644 index 0000000..fd20ac5 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ServerMessageVoiceRequestPhoneNumber.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ServerMessageVoiceRequestPhoneNumber { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ServerMessageVoiceRequestPhoneNumber(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ServerMessageVoiceRequestPhoneNumber byoPhoneNumber(CreateByoPhoneNumberDto value) { + return new ServerMessageVoiceRequestPhoneNumber(new ByoPhoneNumberValue(value)); + } + + public static ServerMessageVoiceRequestPhoneNumber twilio(CreateTwilioPhoneNumberDto value) { + return new ServerMessageVoiceRequestPhoneNumber(new TwilioValue(value)); + } + + public static ServerMessageVoiceRequestPhoneNumber vonage(CreateVonagePhoneNumberDto value) { + return new ServerMessageVoiceRequestPhoneNumber(new VonageValue(value)); + } + + public static ServerMessageVoiceRequestPhoneNumber vapi(CreateVapiPhoneNumberDto value) { + return new ServerMessageVoiceRequestPhoneNumber(new VapiValue(value)); + } + + public boolean isByoPhoneNumber() { + return value instanceof ByoPhoneNumberValue; + } + + public boolean isTwilio() { + return value instanceof TwilioValue; + } + + public boolean isVonage() { + return value instanceof VonageValue; + } + + public boolean isVapi() { + return value instanceof VapiValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getByoPhoneNumber() { + if (isByoPhoneNumber()) { + return Optional.of(((ByoPhoneNumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getTwilio() { + if (isTwilio()) { + return Optional.of(((TwilioValue) value).value); + } + return Optional.empty(); + } + + public Optional getVonage() { + if (isVonage()) { + return Optional.of(((VonageValue) value).value); + } + return Optional.empty(); + } + + public Optional getVapi() { + if (isVapi()) { + return Optional.of(((VapiValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitByoPhoneNumber(CreateByoPhoneNumberDto byoPhoneNumber); + + T visitTwilio(CreateTwilioPhoneNumberDto twilio); + + T visitVonage(CreateVonagePhoneNumberDto vonage); + + T visitVapi(CreateVapiPhoneNumberDto vapi); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "provider", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(ByoPhoneNumberValue.class), + @JsonSubTypes.Type(TwilioValue.class), + @JsonSubTypes.Type(VonageValue.class), + @JsonSubTypes.Type(VapiValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("byo-phone-number") + private static final class ByoPhoneNumberValue implements Value { + @JsonUnwrapped + private CreateByoPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ByoPhoneNumberValue() {} + + private ByoPhoneNumberValue(CreateByoPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitByoPhoneNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ByoPhoneNumberValue && equalTo((ByoPhoneNumberValue) other); + } + + private boolean equalTo(ByoPhoneNumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageVoiceRequestPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("twilio") + private static final class TwilioValue implements Value { + @JsonUnwrapped + private CreateTwilioPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TwilioValue() {} + + private TwilioValue(CreateTwilioPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTwilio(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioValue && equalTo((TwilioValue) other); + } + + private boolean equalTo(TwilioValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageVoiceRequestPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vonage") + private static final class VonageValue implements Value { + @JsonUnwrapped + private CreateVonagePhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VonageValue() {} + + private VonageValue(CreateVonagePhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVonage(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageValue && equalTo((VonageValue) other); + } + + private boolean equalTo(VonageValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageVoiceRequestPhoneNumber{" + "value: " + value + "}"; + } + } + + @JsonTypeName("vapi") + private static final class VapiValue implements Value { + @JsonUnwrapped + private CreateVapiPhoneNumberDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VapiValue() {} + + private VapiValue(CreateVapiPhoneNumberDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVapi(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiValue && equalTo((VapiValue) other); + } + + private boolean equalTo(VapiValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageVoiceRequestPhoneNumber{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ServerMessageVoiceRequestPhoneNumber{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/SipTrunkGateway.java b/src/main/java/com/vapi/api/types/SipTrunkGateway.java new file mode 100644 index 0000000..8384df2 --- /dev/null +++ b/src/main/java/com/vapi/api/types/SipTrunkGateway.java @@ -0,0 +1,366 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SipTrunkGateway.Builder.class) +public final class SipTrunkGateway { + private final String ip; + + private final Optional port; + + private final Optional netmask; + + private final Optional inboundEnabled; + + private final Optional outboundEnabled; + + private final Optional outboundProtocol; + + private final Optional optionsPingEnabled; + + private final Map additionalProperties; + + private SipTrunkGateway( + String ip, + Optional port, + Optional netmask, + Optional inboundEnabled, + Optional outboundEnabled, + Optional outboundProtocol, + Optional optionsPingEnabled, + Map additionalProperties) { + this.ip = ip; + this.port = port; + this.netmask = netmask; + this.inboundEnabled = inboundEnabled; + this.outboundEnabled = outboundEnabled; + this.outboundProtocol = outboundProtocol; + this.optionsPingEnabled = optionsPingEnabled; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the address of the gateway. It can be an IPv4 address like 1.1.1.1 or a fully qualified domain name like my-sip-trunk.pstn.twilio.com. + */ + @JsonProperty("ip") + public String getIp() { + return ip; + } + + /** + * @return This is the port number of the gateway. Default is 5060. + *

@default 5060

+ */ + @JsonProperty("port") + public Optional getPort() { + return port; + } + + /** + * @return This is the netmask of the gateway. Defaults to 32. + *

@default 32

+ */ + @JsonProperty("netmask") + public Optional getNetmask() { + return netmask; + } + + /** + * @return This is whether inbound calls are allowed from this gateway. Default is true. + *

@default true

+ */ + @JsonProperty("inboundEnabled") + public Optional getInboundEnabled() { + return inboundEnabled; + } + + /** + * @return This is whether outbound calls should be sent to this gateway. Default is true. + *

Note, if netmask is less than 32, it doesn't affect the outbound IPs that are tried. 1 attempt is made to ip:port.

+ *

@default true

+ */ + @JsonProperty("outboundEnabled") + public Optional getOutboundEnabled() { + return outboundEnabled; + } + + /** + * @return This is the protocol to use for SIP signaling outbound calls. Default is udp. + *

@default udp

+ */ + @JsonProperty("outboundProtocol") + public Optional getOutboundProtocol() { + return outboundProtocol; + } + + /** + * @return This is whether to send options ping to the gateway. This can be used to check if the gateway is reachable. Default is false. + *

This is useful for high availability setups where you want to check if the gateway is reachable before routing calls to it. Note, if no gateway for a trunk is reachable, outbound calls will be rejected.

+ *

@default false

+ */ + @JsonProperty("optionsPingEnabled") + public Optional getOptionsPingEnabled() { + return optionsPingEnabled; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipTrunkGateway && equalTo((SipTrunkGateway) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SipTrunkGateway other) { + return ip.equals(other.ip) + && port.equals(other.port) + && netmask.equals(other.netmask) + && inboundEnabled.equals(other.inboundEnabled) + && outboundEnabled.equals(other.outboundEnabled) + && outboundProtocol.equals(other.outboundProtocol) + && optionsPingEnabled.equals(other.optionsPingEnabled); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.ip, + this.port, + this.netmask, + this.inboundEnabled, + this.outboundEnabled, + this.outboundProtocol, + this.optionsPingEnabled); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IpStage builder() { + return new Builder(); + } + + public interface IpStage { + _FinalStage ip(@NotNull String ip); + + Builder from(SipTrunkGateway other); + } + + public interface _FinalStage { + SipTrunkGateway build(); + + _FinalStage port(Optional port); + + _FinalStage port(Double port); + + _FinalStage netmask(Optional netmask); + + _FinalStage netmask(Double netmask); + + _FinalStage inboundEnabled(Optional inboundEnabled); + + _FinalStage inboundEnabled(Boolean inboundEnabled); + + _FinalStage outboundEnabled(Optional outboundEnabled); + + _FinalStage outboundEnabled(Boolean outboundEnabled); + + _FinalStage outboundProtocol(Optional outboundProtocol); + + _FinalStage outboundProtocol(SipTrunkGatewayOutboundProtocol outboundProtocol); + + _FinalStage optionsPingEnabled(Optional optionsPingEnabled); + + _FinalStage optionsPingEnabled(Boolean optionsPingEnabled); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IpStage, _FinalStage { + private String ip; + + private Optional optionsPingEnabled = Optional.empty(); + + private Optional outboundProtocol = Optional.empty(); + + private Optional outboundEnabled = Optional.empty(); + + private Optional inboundEnabled = Optional.empty(); + + private Optional netmask = Optional.empty(); + + private Optional port = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SipTrunkGateway other) { + ip(other.getIp()); + port(other.getPort()); + netmask(other.getNetmask()); + inboundEnabled(other.getInboundEnabled()); + outboundEnabled(other.getOutboundEnabled()); + outboundProtocol(other.getOutboundProtocol()); + optionsPingEnabled(other.getOptionsPingEnabled()); + return this; + } + + /** + *

This is the address of the gateway. It can be an IPv4 address like 1.1.1.1 or a fully qualified domain name like my-sip-trunk.pstn.twilio.com.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ip") + public _FinalStage ip(@NotNull String ip) { + this.ip = Objects.requireNonNull(ip, "ip must not be null"); + return this; + } + + /** + *

This is whether to send options ping to the gateway. This can be used to check if the gateway is reachable. Default is false.

+ *

This is useful for high availability setups where you want to check if the gateway is reachable before routing calls to it. Note, if no gateway for a trunk is reachable, outbound calls will be rejected.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage optionsPingEnabled(Boolean optionsPingEnabled) { + this.optionsPingEnabled = Optional.ofNullable(optionsPingEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "optionsPingEnabled", nulls = Nulls.SKIP) + public _FinalStage optionsPingEnabled(Optional optionsPingEnabled) { + this.optionsPingEnabled = optionsPingEnabled; + return this; + } + + /** + *

This is the protocol to use for SIP signaling outbound calls. Default is udp.

+ *

@default udp

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage outboundProtocol(SipTrunkGatewayOutboundProtocol outboundProtocol) { + this.outboundProtocol = Optional.ofNullable(outboundProtocol); + return this; + } + + @java.lang.Override + @JsonSetter(value = "outboundProtocol", nulls = Nulls.SKIP) + public _FinalStage outboundProtocol(Optional outboundProtocol) { + this.outboundProtocol = outboundProtocol; + return this; + } + + /** + *

This is whether outbound calls should be sent to this gateway. Default is true.

+ *

Note, if netmask is less than 32, it doesn't affect the outbound IPs that are tried. 1 attempt is made to ip:port.

+ *

@default true

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage outboundEnabled(Boolean outboundEnabled) { + this.outboundEnabled = Optional.ofNullable(outboundEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "outboundEnabled", nulls = Nulls.SKIP) + public _FinalStage outboundEnabled(Optional outboundEnabled) { + this.outboundEnabled = outboundEnabled; + return this; + } + + /** + *

This is whether inbound calls are allowed from this gateway. Default is true.

+ *

@default true

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage inboundEnabled(Boolean inboundEnabled) { + this.inboundEnabled = Optional.ofNullable(inboundEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "inboundEnabled", nulls = Nulls.SKIP) + public _FinalStage inboundEnabled(Optional inboundEnabled) { + this.inboundEnabled = inboundEnabled; + return this; + } + + /** + *

This is the netmask of the gateway. Defaults to 32.

+ *

@default 32

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage netmask(Double netmask) { + this.netmask = Optional.ofNullable(netmask); + return this; + } + + @java.lang.Override + @JsonSetter(value = "netmask", nulls = Nulls.SKIP) + public _FinalStage netmask(Optional netmask) { + this.netmask = netmask; + return this; + } + + /** + *

This is the port number of the gateway. Default is 5060.

+ *

@default 5060

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage port(Double port) { + this.port = Optional.ofNullable(port); + return this; + } + + @java.lang.Override + @JsonSetter(value = "port", nulls = Nulls.SKIP) + public _FinalStage port(Optional port) { + this.port = port; + return this; + } + + @java.lang.Override + public SipTrunkGateway build() { + return new SipTrunkGateway( + ip, + port, + netmask, + inboundEnabled, + outboundEnabled, + outboundProtocol, + optionsPingEnabled, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/SipTrunkGatewayOutboundProtocol.java b/src/main/java/com/vapi/api/types/SipTrunkGatewayOutboundProtocol.java new file mode 100644 index 0000000..2319e64 --- /dev/null +++ b/src/main/java/com/vapi/api/types/SipTrunkGatewayOutboundProtocol.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum SipTrunkGatewayOutboundProtocol { + TLS_SRTP("tls/srtp"), + + TCP("tcp"), + + TLS("tls"), + + UDP("udp"); + + private final String value; + + SipTrunkGatewayOutboundProtocol(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/SipTrunkOutboundAuthenticationPlan.java b/src/main/java/com/vapi/api/types/SipTrunkOutboundAuthenticationPlan.java new file mode 100644 index 0000000..1a4607c --- /dev/null +++ b/src/main/java/com/vapi/api/types/SipTrunkOutboundAuthenticationPlan.java @@ -0,0 +1,153 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SipTrunkOutboundAuthenticationPlan.Builder.class) +public final class SipTrunkOutboundAuthenticationPlan { + private final Optional authPassword; + + private final Optional authUsername; + + private final Optional sipRegisterPlan; + + private final Map additionalProperties; + + private SipTrunkOutboundAuthenticationPlan( + Optional authPassword, + Optional authUsername, + Optional sipRegisterPlan, + Map additionalProperties) { + this.authPassword = authPassword; + this.authUsername = authUsername; + this.sipRegisterPlan = sipRegisterPlan; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("authPassword") + public Optional getAuthPassword() { + return authPassword; + } + + @JsonProperty("authUsername") + public Optional getAuthUsername() { + return authUsername; + } + + /** + * @return This can be used to configure if SIP register is required by the SIP trunk. If not provided, no SIP registration will be attempted. + */ + @JsonProperty("sipRegisterPlan") + public Optional getSipRegisterPlan() { + return sipRegisterPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipTrunkOutboundAuthenticationPlan + && equalTo((SipTrunkOutboundAuthenticationPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SipTrunkOutboundAuthenticationPlan other) { + return authPassword.equals(other.authPassword) + && authUsername.equals(other.authUsername) + && sipRegisterPlan.equals(other.sipRegisterPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.authPassword, this.authUsername, this.sipRegisterPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional authPassword = Optional.empty(); + + private Optional authUsername = Optional.empty(); + + private Optional sipRegisterPlan = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SipTrunkOutboundAuthenticationPlan other) { + authPassword(other.getAuthPassword()); + authUsername(other.getAuthUsername()); + sipRegisterPlan(other.getSipRegisterPlan()); + return this; + } + + @JsonSetter(value = "authPassword", nulls = Nulls.SKIP) + public Builder authPassword(Optional authPassword) { + this.authPassword = authPassword; + return this; + } + + public Builder authPassword(String authPassword) { + this.authPassword = Optional.ofNullable(authPassword); + return this; + } + + @JsonSetter(value = "authUsername", nulls = Nulls.SKIP) + public Builder authUsername(Optional authUsername) { + this.authUsername = authUsername; + return this; + } + + public Builder authUsername(String authUsername) { + this.authUsername = Optional.ofNullable(authUsername); + return this; + } + + @JsonSetter(value = "sipRegisterPlan", nulls = Nulls.SKIP) + public Builder sipRegisterPlan(Optional sipRegisterPlan) { + this.sipRegisterPlan = sipRegisterPlan; + return this; + } + + public Builder sipRegisterPlan(SipTrunkOutboundSipRegisterPlan sipRegisterPlan) { + this.sipRegisterPlan = Optional.ofNullable(sipRegisterPlan); + return this; + } + + public SipTrunkOutboundAuthenticationPlan build() { + return new SipTrunkOutboundAuthenticationPlan( + authPassword, authUsername, sipRegisterPlan, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/SipTrunkOutboundSipRegisterPlan.java b/src/main/java/com/vapi/api/types/SipTrunkOutboundSipRegisterPlan.java new file mode 100644 index 0000000..d95354e --- /dev/null +++ b/src/main/java/com/vapi/api/types/SipTrunkOutboundSipRegisterPlan.java @@ -0,0 +1,143 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SipTrunkOutboundSipRegisterPlan.Builder.class) +public final class SipTrunkOutboundSipRegisterPlan { + private final Optional domain; + + private final Optional username; + + private final Optional realm; + + private final Map additionalProperties; + + private SipTrunkOutboundSipRegisterPlan( + Optional domain, + Optional username, + Optional realm, + Map additionalProperties) { + this.domain = domain; + this.username = username; + this.realm = realm; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("domain") + public Optional getDomain() { + return domain; + } + + @JsonProperty("username") + public Optional getUsername() { + return username; + } + + @JsonProperty("realm") + public Optional getRealm() { + return realm; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipTrunkOutboundSipRegisterPlan && equalTo((SipTrunkOutboundSipRegisterPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SipTrunkOutboundSipRegisterPlan other) { + return domain.equals(other.domain) && username.equals(other.username) && realm.equals(other.realm); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.domain, this.username, this.realm); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional domain = Optional.empty(); + + private Optional username = Optional.empty(); + + private Optional realm = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SipTrunkOutboundSipRegisterPlan other) { + domain(other.getDomain()); + username(other.getUsername()); + realm(other.getRealm()); + return this; + } + + @JsonSetter(value = "domain", nulls = Nulls.SKIP) + public Builder domain(Optional domain) { + this.domain = domain; + return this; + } + + public Builder domain(String domain) { + this.domain = Optional.ofNullable(domain); + return this; + } + + @JsonSetter(value = "username", nulls = Nulls.SKIP) + public Builder username(Optional username) { + this.username = username; + return this; + } + + public Builder username(String username) { + this.username = Optional.ofNullable(username); + return this; + } + + @JsonSetter(value = "realm", nulls = Nulls.SKIP) + public Builder realm(Optional realm) { + this.realm = realm; + return this; + } + + public Builder realm(String realm) { + this.realm = Optional.ofNullable(realm); + return this; + } + + public SipTrunkOutboundSipRegisterPlan build() { + return new SipTrunkOutboundSipRegisterPlan(domain, username, realm, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/Squad.java b/src/main/java/com/vapi/api/types/Squad.java new file mode 100644 index 0000000..8acfce3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/Squad.java @@ -0,0 +1,339 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Squad.Builder.class) +public final class Squad { + private final Optional name; + + private final List members; + + private final Optional membersOverrides; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private Squad( + Optional name, + List members, + Optional membersOverrides, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.name = name; + this.members = members; + this.membersOverrides = membersOverrides; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the name of the squad. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the list of assistants that make up the squad. + *

The call will start with the first assistant in the list.

+ */ + @JsonProperty("members") + public List getMembers() { + return members; + } + + /** + * @return This can be used to override all the assistants' settings and provide values for their template variables. + *

Both membersOverrides and members[n].assistantOverrides can be used together. First, members[n].assistantOverrides is applied. Then, membersOverrides is applied as a global override.

+ */ + @JsonProperty("membersOverrides") + public Optional getMembersOverrides() { + return membersOverrides; + } + + /** + * @return This is the unique identifier for the squad. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this squad belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the squad was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the squad was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Squad && equalTo((Squad) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Squad other) { + return name.equals(other.name) + && members.equals(other.members) + && membersOverrides.equals(other.membersOverrides) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.name, this.members, this.membersOverrides, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(Squad other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + Squad build(); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage members(List members); + + _FinalStage addMembers(SquadMemberDto members); + + _FinalStage addAllMembers(List members); + + _FinalStage membersOverrides(Optional membersOverrides); + + _FinalStage membersOverrides(AssistantOverrides membersOverrides); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional membersOverrides = Optional.empty(); + + private List members = new ArrayList<>(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Squad other) { + name(other.getName()); + members(other.getMembers()); + membersOverrides(other.getMembersOverrides()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is the unique identifier for the squad.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this squad belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the squad was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the squad was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This can be used to override all the assistants' settings and provide values for their template variables.

+ *

Both membersOverrides and members[n].assistantOverrides can be used together. First, members[n].assistantOverrides is applied. Then, membersOverrides is applied as a global override.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage membersOverrides(AssistantOverrides membersOverrides) { + this.membersOverrides = Optional.ofNullable(membersOverrides); + return this; + } + + @java.lang.Override + @JsonSetter(value = "membersOverrides", nulls = Nulls.SKIP) + public _FinalStage membersOverrides(Optional membersOverrides) { + this.membersOverrides = membersOverrides; + return this; + } + + /** + *

This is the list of assistants that make up the squad.

+ *

The call will start with the first assistant in the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllMembers(List members) { + this.members.addAll(members); + return this; + } + + /** + *

This is the list of assistants that make up the squad.

+ *

The call will start with the first assistant in the list.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addMembers(SquadMemberDto members) { + this.members.add(members); + return this; + } + + @java.lang.Override + @JsonSetter(value = "members", nulls = Nulls.SKIP) + public _FinalStage members(List members) { + this.members.clear(); + this.members.addAll(members); + return this; + } + + /** + *

This is the name of the squad.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public Squad build() { + return new Squad(name, members, membersOverrides, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/SquadMemberDto.java b/src/main/java/com/vapi/api/types/SquadMemberDto.java new file mode 100644 index 0000000..16f327d --- /dev/null +++ b/src/main/java/com/vapi/api/types/SquadMemberDto.java @@ -0,0 +1,184 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SquadMemberDto.Builder.class) +public final class SquadMemberDto { + private final Optional assistantId; + + private final Optional assistant; + + private final Optional assistantOverrides; + + private final Optional> assistantDestinations; + + private final Map additionalProperties; + + private SquadMemberDto( + Optional assistantId, + Optional assistant, + Optional assistantOverrides, + Optional> assistantDestinations, + Map additionalProperties) { + this.assistantId = assistantId; + this.assistant = assistant; + this.assistantOverrides = assistantOverrides; + this.assistantDestinations = assistantDestinations; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the assistant that will be used for the call. To use a transient assistant, use assistant instead. + */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the assistant that will be used for the call. To use an existing assistant, use assistantId instead. + */ + @JsonProperty("assistant") + public Optional getAssistant() { + return assistant; + } + + /** + * @return This can be used to override the assistant's settings and provide values for it's template variables. + */ + @JsonProperty("assistantOverrides") + public Optional getAssistantOverrides() { + return assistantOverrides; + } + + /** + * @return These are the others assistants that this assistant can transfer to. + *

If the assistant already has transfer call tool, these destinations are just appended to existing ones.

+ */ + @JsonProperty("assistantDestinations") + public Optional> getAssistantDestinations() { + return assistantDestinations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SquadMemberDto && equalTo((SquadMemberDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SquadMemberDto other) { + return assistantId.equals(other.assistantId) + && assistant.equals(other.assistant) + && assistantOverrides.equals(other.assistantOverrides) + && assistantDestinations.equals(other.assistantDestinations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.assistantId, this.assistant, this.assistantOverrides, this.assistantDestinations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional assistantId = Optional.empty(); + + private Optional assistant = Optional.empty(); + + private Optional assistantOverrides = Optional.empty(); + + private Optional> assistantDestinations = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SquadMemberDto other) { + assistantId(other.getAssistantId()); + assistant(other.getAssistant()); + assistantOverrides(other.getAssistantOverrides()); + assistantDestinations(other.getAssistantDestinations()); + return this; + } + + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public Builder assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + public Builder assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @JsonSetter(value = "assistant", nulls = Nulls.SKIP) + public Builder assistant(Optional assistant) { + this.assistant = assistant; + return this; + } + + public Builder assistant(CreateAssistantDto assistant) { + this.assistant = Optional.ofNullable(assistant); + return this; + } + + @JsonSetter(value = "assistantOverrides", nulls = Nulls.SKIP) + public Builder assistantOverrides(Optional assistantOverrides) { + this.assistantOverrides = assistantOverrides; + return this; + } + + public Builder assistantOverrides(AssistantOverrides assistantOverrides) { + this.assistantOverrides = Optional.ofNullable(assistantOverrides); + return this; + } + + @JsonSetter(value = "assistantDestinations", nulls = Nulls.SKIP) + public Builder assistantDestinations(Optional> assistantDestinations) { + this.assistantDestinations = assistantDestinations; + return this; + } + + public Builder assistantDestinations(List assistantDestinations) { + this.assistantDestinations = Optional.ofNullable(assistantDestinations); + return this; + } + + public SquadMemberDto build() { + return new SquadMemberDto( + assistantId, assistant, assistantOverrides, assistantDestinations, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/StartSpeakingPlan.java b/src/main/java/com/vapi/api/types/StartSpeakingPlan.java new file mode 100644 index 0000000..adc3751 --- /dev/null +++ b/src/main/java/com/vapi/api/types/StartSpeakingPlan.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = StartSpeakingPlan.Builder.class) +public final class StartSpeakingPlan { + private final Optional waitSeconds; + + private final Optional smartEndpointingEnabled; + + private final Optional transcriptionEndpointingPlan; + + private final Map additionalProperties; + + private StartSpeakingPlan( + Optional waitSeconds, + Optional smartEndpointingEnabled, + Optional transcriptionEndpointingPlan, + Map additionalProperties) { + this.waitSeconds = waitSeconds; + this.smartEndpointingEnabled = smartEndpointingEnabled; + this.transcriptionEndpointingPlan = transcriptionEndpointingPlan; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is how long assistant waits before speaking. Defaults to 0.4. + *

This is the minimum it will wait but if there is latency is the pipeline, this minimum will be exceeded. This is really a stopgap in case the pipeline is moving too fast.

+ *

Example:

+ *
    + *
  • If model generates tokens and voice generates bytes within 100ms, the pipeline still waits 300ms before outputting speech.
  • + *
+ *

Usage:

+ *
    + *
  • If the customer is taking long pauses, set this to a higher value.
  • + *
  • If the assistant is accidentally jumping in too much, set this to a higher value.
  • + *
+ *

@default 0.4

+ */ + @JsonProperty("waitSeconds") + public Optional getWaitSeconds() { + return waitSeconds; + } + + /** + * @return This determines if a customer speech is considered done (endpointing) using the VAP model on customer's speech. This is good for middle-of-thought detection. + *

Once an endpoint is triggered, the request is sent to assistant.model.

+ *

Default false since experimental.

+ *

@default false

+ */ + @JsonProperty("smartEndpointingEnabled") + public Optional getSmartEndpointingEnabled() { + return smartEndpointingEnabled; + } + + /** + * @return This determines how a customer speech is considered done (endpointing) using the transcription of customer's speech. + *

Once an endpoint is triggered, the request is sent to assistant.model.

+ */ + @JsonProperty("transcriptionEndpointingPlan") + public Optional getTranscriptionEndpointingPlan() { + return transcriptionEndpointingPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StartSpeakingPlan && equalTo((StartSpeakingPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(StartSpeakingPlan other) { + return waitSeconds.equals(other.waitSeconds) + && smartEndpointingEnabled.equals(other.smartEndpointingEnabled) + && transcriptionEndpointingPlan.equals(other.transcriptionEndpointingPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.waitSeconds, this.smartEndpointingEnabled, this.transcriptionEndpointingPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional waitSeconds = Optional.empty(); + + private Optional smartEndpointingEnabled = Optional.empty(); + + private Optional transcriptionEndpointingPlan = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(StartSpeakingPlan other) { + waitSeconds(other.getWaitSeconds()); + smartEndpointingEnabled(other.getSmartEndpointingEnabled()); + transcriptionEndpointingPlan(other.getTranscriptionEndpointingPlan()); + return this; + } + + @JsonSetter(value = "waitSeconds", nulls = Nulls.SKIP) + public Builder waitSeconds(Optional waitSeconds) { + this.waitSeconds = waitSeconds; + return this; + } + + public Builder waitSeconds(Double waitSeconds) { + this.waitSeconds = Optional.ofNullable(waitSeconds); + return this; + } + + @JsonSetter(value = "smartEndpointingEnabled", nulls = Nulls.SKIP) + public Builder smartEndpointingEnabled(Optional smartEndpointingEnabled) { + this.smartEndpointingEnabled = smartEndpointingEnabled; + return this; + } + + public Builder smartEndpointingEnabled(Boolean smartEndpointingEnabled) { + this.smartEndpointingEnabled = Optional.ofNullable(smartEndpointingEnabled); + return this; + } + + @JsonSetter(value = "transcriptionEndpointingPlan", nulls = Nulls.SKIP) + public Builder transcriptionEndpointingPlan( + Optional transcriptionEndpointingPlan) { + this.transcriptionEndpointingPlan = transcriptionEndpointingPlan; + return this; + } + + public Builder transcriptionEndpointingPlan(TranscriptionEndpointingPlan transcriptionEndpointingPlan) { + this.transcriptionEndpointingPlan = Optional.ofNullable(transcriptionEndpointingPlan); + return this; + } + + public StartSpeakingPlan build() { + return new StartSpeakingPlan( + waitSeconds, smartEndpointingEnabled, transcriptionEndpointingPlan, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/StepDestination.java b/src/main/java/com/vapi/api/types/StepDestination.java new file mode 100644 index 0000000..dc7d17c --- /dev/null +++ b/src/main/java/com/vapi/api/types/StepDestination.java @@ -0,0 +1,148 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = StepDestination.Builder.class) +public final class StepDestination { + private final Optional> conditions; + + private final String stepName; + + private final Map additionalProperties; + + private StepDestination( + Optional> conditions, + String stepName, + Map additionalProperties) { + this.conditions = conditions; + this.stepName = stepName; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public String getType() { + return "step"; + } + + /** + * @return This is an optional array of conditions that must be met for this destination to be triggered. If empty, this is the default destination that the step transfers to. + */ + @JsonProperty("conditions") + public Optional> getConditions() { + return conditions; + } + + @JsonProperty("stepName") + public String getStepName() { + return stepName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StepDestination && equalTo((StepDestination) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(StepDestination other) { + return conditions.equals(other.conditions) && stepName.equals(other.stepName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.conditions, this.stepName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StepNameStage builder() { + return new Builder(); + } + + public interface StepNameStage { + _FinalStage stepName(@NotNull String stepName); + + Builder from(StepDestination other); + } + + public interface _FinalStage { + StepDestination build(); + + _FinalStage conditions(Optional> conditions); + + _FinalStage conditions(List conditions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StepNameStage, _FinalStage { + private String stepName; + + private Optional> conditions = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(StepDestination other) { + conditions(other.getConditions()); + stepName(other.getStepName()); + return this; + } + + @java.lang.Override + @JsonSetter("stepName") + public _FinalStage stepName(@NotNull String stepName) { + this.stepName = Objects.requireNonNull(stepName, "stepName must not be null"); + return this; + } + + /** + *

This is an optional array of conditions that must be met for this destination to be triggered. If empty, this is the default destination that the step transfers to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage conditions(List conditions) { + this.conditions = Optional.ofNullable(conditions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "conditions", nulls = Nulls.SKIP) + public _FinalStage conditions(Optional> conditions) { + this.conditions = conditions; + return this; + } + + @java.lang.Override + public StepDestination build() { + return new StepDestination(conditions, stepName, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/StepDestinationConditionsItem.java b/src/main/java/com/vapi/api/types/StepDestinationConditionsItem.java new file mode 100644 index 0000000..76c24f1 --- /dev/null +++ b/src/main/java/com/vapi/api/types/StepDestinationConditionsItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class StepDestinationConditionsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private StepDestinationConditionsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static StepDestinationConditionsItem modelBased(ModelBasedCondition value) { + return new StepDestinationConditionsItem(new ModelBasedValue(value)); + } + + public static StepDestinationConditionsItem ruleBased(RuleBasedCondition value) { + return new StepDestinationConditionsItem(new RuleBasedValue(value)); + } + + public boolean isModelBased() { + return value instanceof ModelBasedValue; + } + + public boolean isRuleBased() { + return value instanceof RuleBasedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getModelBased() { + if (isModelBased()) { + return Optional.of(((ModelBasedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRuleBased() { + if (isRuleBased()) { + return Optional.of(((RuleBasedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitModelBased(ModelBasedCondition modelBased); + + T visitRuleBased(RuleBasedCondition ruleBased); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(ModelBasedValue.class), @JsonSubTypes.Type(RuleBasedValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("model-based") + private static final class ModelBasedValue implements Value { + @JsonUnwrapped + private ModelBasedCondition value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private ModelBasedValue() {} + + private ModelBasedValue(ModelBasedCondition value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitModelBased(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ModelBasedValue && equalTo((ModelBasedValue) other); + } + + private boolean equalTo(ModelBasedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "StepDestinationConditionsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("rule-based") + private static final class RuleBasedValue implements Value { + @JsonUnwrapped + private RuleBasedCondition value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RuleBasedValue() {} + + private RuleBasedValue(RuleBasedCondition value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRuleBased(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RuleBasedValue && equalTo((RuleBasedValue) other); + } + + private boolean equalTo(RuleBasedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "StepDestinationConditionsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "StepDestinationConditionsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/StopSpeakingPlan.java b/src/main/java/com/vapi/api/types/StopSpeakingPlan.java new file mode 100644 index 0000000..2ae30a5 --- /dev/null +++ b/src/main/java/com/vapi/api/types/StopSpeakingPlan.java @@ -0,0 +1,169 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = StopSpeakingPlan.Builder.class) +public final class StopSpeakingPlan { + private final Optional numWords; + + private final Optional voiceSeconds; + + private final Optional backoffSeconds; + + private final Map additionalProperties; + + private StopSpeakingPlan( + Optional numWords, + Optional voiceSeconds, + Optional backoffSeconds, + Map additionalProperties) { + this.numWords = numWords; + this.voiceSeconds = voiceSeconds; + this.backoffSeconds = backoffSeconds; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the number of words that the customer has to say before the assistant will stop talking. + *

Words like "stop", "actually", "no", etc. will always interrupt immediately regardless of this value.

+ *

Words like "okay", "yeah", "right" will never interrupt.

+ *

When set to 0, voiceSeconds is used in addition to the transcriptions to determine the customer has started speaking.

+ *

Defaults to 0.

+ *

@default 0

+ */ + @JsonProperty("numWords") + public Optional getNumWords() { + return numWords; + } + + /** + * @return This is the seconds customer has to speak before the assistant stops talking. This uses the VAD (Voice Activity Detection) spike to determine if the customer has started speaking. + *

Considerations:

+ *
    + *
  • A lower value might be more responsive but could potentially pick up non-speech sounds.
  • + *
  • A higher value reduces false positives but might slightly delay the detection of speech onset.
  • + *
+ *

This is only used if numWords is set to 0.

+ *

Defaults to 0.2

+ *

@default 0.2

+ */ + @JsonProperty("voiceSeconds") + public Optional getVoiceSeconds() { + return voiceSeconds; + } + + /** + * @return This is the seconds to wait before the assistant will start talking again after being interrupted. + *

Defaults to 1.

+ *

@default 1

+ */ + @JsonProperty("backoffSeconds") + public Optional getBackoffSeconds() { + return backoffSeconds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StopSpeakingPlan && equalTo((StopSpeakingPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(StopSpeakingPlan other) { + return numWords.equals(other.numWords) + && voiceSeconds.equals(other.voiceSeconds) + && backoffSeconds.equals(other.backoffSeconds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.numWords, this.voiceSeconds, this.backoffSeconds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional numWords = Optional.empty(); + + private Optional voiceSeconds = Optional.empty(); + + private Optional backoffSeconds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(StopSpeakingPlan other) { + numWords(other.getNumWords()); + voiceSeconds(other.getVoiceSeconds()); + backoffSeconds(other.getBackoffSeconds()); + return this; + } + + @JsonSetter(value = "numWords", nulls = Nulls.SKIP) + public Builder numWords(Optional numWords) { + this.numWords = numWords; + return this; + } + + public Builder numWords(Double numWords) { + this.numWords = Optional.ofNullable(numWords); + return this; + } + + @JsonSetter(value = "voiceSeconds", nulls = Nulls.SKIP) + public Builder voiceSeconds(Optional voiceSeconds) { + this.voiceSeconds = voiceSeconds; + return this; + } + + public Builder voiceSeconds(Double voiceSeconds) { + this.voiceSeconds = Optional.ofNullable(voiceSeconds); + return this; + } + + @JsonSetter(value = "backoffSeconds", nulls = Nulls.SKIP) + public Builder backoffSeconds(Optional backoffSeconds) { + this.backoffSeconds = backoffSeconds; + return this; + } + + public Builder backoffSeconds(Double backoffSeconds) { + this.backoffSeconds = Optional.ofNullable(backoffSeconds); + return this; + } + + public StopSpeakingPlan build() { + return new StopSpeakingPlan(numWords, voiceSeconds, backoffSeconds, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/StructuredDataPlan.java b/src/main/java/com/vapi/api/types/StructuredDataPlan.java new file mode 100644 index 0000000..e1040c0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/StructuredDataPlan.java @@ -0,0 +1,199 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = StructuredDataPlan.Builder.class) +public final class StructuredDataPlan { + private final Optional>> messages; + + private final Optional enabled; + + private final Optional schema; + + private final Optional timeoutSeconds; + + private final Map additionalProperties; + + private StructuredDataPlan( + Optional>> messages, + Optional enabled, + Optional schema, + Optional timeoutSeconds, + Map additionalProperties) { + this.messages = messages; + this.enabled = enabled; + this.schema = schema; + this.timeoutSeconds = timeoutSeconds; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the messages used to generate the structured data. + *

@default: [ { "role": "system", "content": "You are an expert data extractor. You will be given a transcript of a call. Extract structured data per the JSON Schema. DO NOT return anything except the structured data.\n\nJson Schema:\\n{{schema}}\n\nOnly respond with the JSON." }, { "role": "user", "content": "Here is the transcript:\n\n{{transcript}}\n\n" } ]

+ *

You can customize by providing any messages you want.

+ *

Here are the template variables available:

+ *
    + *
  • {{transcript}}: the transcript of the call from call.artifact.transcript- {{systemPrompt}}: the system prompt of the call from assistant.model.messages[type=system].content- {{schema}}: the schema of the structured data from structuredDataPlan.schema
  • + *
+ */ + @JsonProperty("messages") + public Optional>> getMessages() { + return messages; + } + + /** + * @return This determines whether structured data is generated and stored in call.analysis.structuredData. Defaults to false. + *

Usage:

+ *
    + *
  • If you want to extract structured data, set this to true and provide a schema.
  • + *
+ *

@default false

+ */ + @JsonProperty("enabled") + public Optional getEnabled() { + return enabled; + } + + /** + * @return This is the schema of the structured data. The output is stored in call.analysis.structuredData. + *

Complete guide on JSON Schema can be found here.

+ */ + @JsonProperty("schema") + public Optional getSchema() { + return schema; + } + + /** + * @return This is how long the request is tried before giving up. When request times out, call.analysis.structuredData will be empty. + *

Usage:

+ *
    + *
  • To guarantee the structured data is generated, set this value high. Note, this will delay the end of call report in cases where model is slow to respond.
  • + *
+ *

@default 5 seconds

+ */ + @JsonProperty("timeoutSeconds") + public Optional getTimeoutSeconds() { + return timeoutSeconds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StructuredDataPlan && equalTo((StructuredDataPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(StructuredDataPlan other) { + return messages.equals(other.messages) + && enabled.equals(other.enabled) + && schema.equals(other.schema) + && timeoutSeconds.equals(other.timeoutSeconds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.messages, this.enabled, this.schema, this.timeoutSeconds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional>> messages = Optional.empty(); + + private Optional enabled = Optional.empty(); + + private Optional schema = Optional.empty(); + + private Optional timeoutSeconds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(StructuredDataPlan other) { + messages(other.getMessages()); + enabled(other.getEnabled()); + schema(other.getSchema()); + timeoutSeconds(other.getTimeoutSeconds()); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional>> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List> messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(Boolean enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + @JsonSetter(value = "schema", nulls = Nulls.SKIP) + public Builder schema(Optional schema) { + this.schema = schema; + return this; + } + + public Builder schema(JsonSchema schema) { + this.schema = Optional.ofNullable(schema); + return this; + } + + @JsonSetter(value = "timeoutSeconds", nulls = Nulls.SKIP) + public Builder timeoutSeconds(Optional timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + + public Builder timeoutSeconds(Double timeoutSeconds) { + this.timeoutSeconds = Optional.ofNullable(timeoutSeconds); + return this; + } + + public StructuredDataPlan build() { + return new StructuredDataPlan(messages, enabled, schema, timeoutSeconds, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/SuccessEvaluationPlan.java b/src/main/java/com/vapi/api/types/SuccessEvaluationPlan.java new file mode 100644 index 0000000..15d9804 --- /dev/null +++ b/src/main/java/com/vapi/api/types/SuccessEvaluationPlan.java @@ -0,0 +1,210 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SuccessEvaluationPlan.Builder.class) +public final class SuccessEvaluationPlan { + private final Optional rubric; + + private final Optional>> messages; + + private final Optional enabled; + + private final Optional timeoutSeconds; + + private final Map additionalProperties; + + private SuccessEvaluationPlan( + Optional rubric, + Optional>> messages, + Optional enabled, + Optional timeoutSeconds, + Map additionalProperties) { + this.rubric = rubric; + this.messages = messages; + this.enabled = enabled; + this.timeoutSeconds = timeoutSeconds; + this.additionalProperties = additionalProperties; + } + + /** + * @return This enforces the rubric of the evaluation. The output is stored in call.analysis.successEvaluation. + *

Options include:

+ *
    + *
  • 'NumericScale': A scale of 1 to 10.
  • + *
  • 'DescriptiveScale': A scale of Excellent, Good, Fair, Poor.
  • + *
  • 'Checklist': A checklist of criteria and their status.
  • + *
  • 'Matrix': A grid that evaluates multiple criteria across different performance levels.
  • + *
  • 'PercentageScale': A scale of 0% to 100%.
  • + *
  • 'LikertScale': A scale of Strongly Agree, Agree, Neutral, Disagree, Strongly Disagree.
  • + *
  • 'AutomaticRubric': Automatically break down evaluation into several criteria, each with its own score.
  • + *
  • 'PassFail': A simple 'true' if call passed, 'false' if not.
  • + *
+ *

Default is 'PassFail'.

+ */ + @JsonProperty("rubric") + public Optional getRubric() { + return rubric; + } + + /** + * @return These are the messages used to generate the success evaluation. + *

@default: [ { "role": "system", "content": "You are an expert call evaluator. You will be given a transcript of a call and the system prompt of the AI participant. Determine if the call was successful based on the objectives inferred from the system prompt. DO NOT return anything except the result.\n\nRubric:\\n{{rubric}}\n\nOnly respond with the result." }, { "role": "user", "content": "Here is the transcript:\n\n{{transcript}}\n\n" }, { "role": "user", "content": "Here was the system prompt of the call:\n\n{{systemPrompt}}\n\n" } ]

+ *

You can customize by providing any messages you want.

+ *

Here are the template variables available:

+ *
    + *
  • {{transcript}}: the transcript of the call from call.artifact.transcript- {{systemPrompt}}: the system prompt of the call from assistant.model.messages[type=system].content- {{rubric}}: the rubric of the success evaluation from successEvaluationPlan.rubric
  • + *
+ */ + @JsonProperty("messages") + public Optional>> getMessages() { + return messages; + } + + /** + * @return This determines whether a success evaluation is generated and stored in call.analysis.successEvaluation. Defaults to true. + *

Usage:

+ *
    + *
  • If you want to disable the success evaluation, set this to false.
  • + *
+ *

@default true

+ */ + @JsonProperty("enabled") + public Optional getEnabled() { + return enabled; + } + + /** + * @return This is how long the request is tried before giving up. When request times out, call.analysis.successEvaluation will be empty. + *

Usage:

+ *
    + *
  • To guarantee the success evaluation is generated, set this value high. Note, this will delay the end of call report in cases where model is slow to respond.
  • + *
+ *

@default 5 seconds

+ */ + @JsonProperty("timeoutSeconds") + public Optional getTimeoutSeconds() { + return timeoutSeconds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SuccessEvaluationPlan && equalTo((SuccessEvaluationPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SuccessEvaluationPlan other) { + return rubric.equals(other.rubric) + && messages.equals(other.messages) + && enabled.equals(other.enabled) + && timeoutSeconds.equals(other.timeoutSeconds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.rubric, this.messages, this.enabled, this.timeoutSeconds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional rubric = Optional.empty(); + + private Optional>> messages = Optional.empty(); + + private Optional enabled = Optional.empty(); + + private Optional timeoutSeconds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SuccessEvaluationPlan other) { + rubric(other.getRubric()); + messages(other.getMessages()); + enabled(other.getEnabled()); + timeoutSeconds(other.getTimeoutSeconds()); + return this; + } + + @JsonSetter(value = "rubric", nulls = Nulls.SKIP) + public Builder rubric(Optional rubric) { + this.rubric = rubric; + return this; + } + + public Builder rubric(SuccessEvaluationPlanRubric rubric) { + this.rubric = Optional.ofNullable(rubric); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional>> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List> messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(Boolean enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + @JsonSetter(value = "timeoutSeconds", nulls = Nulls.SKIP) + public Builder timeoutSeconds(Optional timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + + public Builder timeoutSeconds(Double timeoutSeconds) { + this.timeoutSeconds = Optional.ofNullable(timeoutSeconds); + return this; + } + + public SuccessEvaluationPlan build() { + return new SuccessEvaluationPlan(rubric, messages, enabled, timeoutSeconds, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/SuccessEvaluationPlanRubric.java b/src/main/java/com/vapi/api/types/SuccessEvaluationPlanRubric.java new file mode 100644 index 0000000..7a03a5d --- /dev/null +++ b/src/main/java/com/vapi/api/types/SuccessEvaluationPlanRubric.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum SuccessEvaluationPlanRubric { + NUMERIC_SCALE("NumericScale"), + + DESCRIPTIVE_SCALE("DescriptiveScale"), + + CHECKLIST("Checklist"), + + MATRIX("Matrix"), + + PERCENTAGE_SCALE("PercentageScale"), + + LIKERT_SCALE("LikertScale"), + + AUTOMATIC_RUBRIC("AutomaticRubric"), + + PASS_FAIL("PassFail"); + + private final String value; + + SuccessEvaluationPlanRubric(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/SummaryPlan.java b/src/main/java/com/vapi/api/types/SummaryPlan.java new file mode 100644 index 0000000..1f57d7d --- /dev/null +++ b/src/main/java/com/vapi/api/types/SummaryPlan.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SummaryPlan.Builder.class) +public final class SummaryPlan { + private final Optional>> messages; + + private final Optional enabled; + + private final Optional timeoutSeconds; + + private final Map additionalProperties; + + private SummaryPlan( + Optional>> messages, + Optional enabled, + Optional timeoutSeconds, + Map additionalProperties) { + this.messages = messages; + this.enabled = enabled; + this.timeoutSeconds = timeoutSeconds; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the messages used to generate the summary. + *

@default: [ { "role": "system", "content": "You are an expert note-taker. You will be given a transcript of a call. Summarize the call in 2-3 sentences. DO NOT return anything except the summary." }, { "role": "user", "content": "Here is the transcript:\n\n{{transcript}}\n\n" } ]

+ *

You can customize by providing any messages you want.

+ *

Here are the template variables available:

+ *
    + *
  • {{transcript}}: The transcript of the call from call.artifact.transcript- {{systemPrompt}}: The system prompt of the call from assistant.model.messages[type=system].content
  • + *
+ */ + @JsonProperty("messages") + public Optional>> getMessages() { + return messages; + } + + /** + * @return This determines whether a summary is generated and stored in call.analysis.summary. Defaults to true. + *

Usage:

+ *
    + *
  • If you want to disable the summary, set this to false.
  • + *
+ *

@default true

+ */ + @JsonProperty("enabled") + public Optional getEnabled() { + return enabled; + } + + /** + * @return This is how long the request is tried before giving up. When request times out, call.analysis.summary will be empty. + *

Usage:

+ *
    + *
  • To guarantee the summary is generated, set this value high. Note, this will delay the end of call report in cases where model is slow to respond.
  • + *
+ *

@default 5 seconds

+ */ + @JsonProperty("timeoutSeconds") + public Optional getTimeoutSeconds() { + return timeoutSeconds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SummaryPlan && equalTo((SummaryPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SummaryPlan other) { + return messages.equals(other.messages) + && enabled.equals(other.enabled) + && timeoutSeconds.equals(other.timeoutSeconds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.messages, this.enabled, this.timeoutSeconds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional>> messages = Optional.empty(); + + private Optional enabled = Optional.empty(); + + private Optional timeoutSeconds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SummaryPlan other) { + messages(other.getMessages()); + enabled(other.getEnabled()); + timeoutSeconds(other.getTimeoutSeconds()); + return this; + } + + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public Builder messages(Optional>> messages) { + this.messages = messages; + return this; + } + + public Builder messages(List> messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(Boolean enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + @JsonSetter(value = "timeoutSeconds", nulls = Nulls.SKIP) + public Builder timeoutSeconds(Optional timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + + public Builder timeoutSeconds(Double timeoutSeconds) { + this.timeoutSeconds = Optional.ofNullable(timeoutSeconds); + return this; + } + + public SummaryPlan build() { + return new SummaryPlan(messages, enabled, timeoutSeconds, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/SyncVoiceLibraryDto.java b/src/main/java/com/vapi/api/types/SyncVoiceLibraryDto.java new file mode 100644 index 0000000..1d7b99c --- /dev/null +++ b/src/main/java/com/vapi/api/types/SyncVoiceLibraryDto.java @@ -0,0 +1,100 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SyncVoiceLibraryDto.Builder.class) +public final class SyncVoiceLibraryDto { + private final Optional> providers; + + private final Map additionalProperties; + + private SyncVoiceLibraryDto( + Optional> providers, Map additionalProperties) { + this.providers = providers; + this.additionalProperties = additionalProperties; + } + + /** + * @return List of providers you want to sync. + */ + @JsonProperty("providers") + public Optional> getProviders() { + return providers; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SyncVoiceLibraryDto && equalTo((SyncVoiceLibraryDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SyncVoiceLibraryDto other) { + return providers.equals(other.providers); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.providers); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> providers = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(SyncVoiceLibraryDto other) { + providers(other.getProviders()); + return this; + } + + @JsonSetter(value = "providers", nulls = Nulls.SKIP) + public Builder providers(Optional> providers) { + this.providers = providers; + return this; + } + + public Builder providers(List providers) { + this.providers = Optional.ofNullable(providers); + return this; + } + + public SyncVoiceLibraryDto build() { + return new SyncVoiceLibraryDto(providers, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/SyncVoiceLibraryDtoProvidersItem.java b/src/main/java/com/vapi/api/types/SyncVoiceLibraryDtoProvidersItem.java new file mode 100644 index 0000000..9c73069 --- /dev/null +++ b/src/main/java/com/vapi/api/types/SyncVoiceLibraryDtoProvidersItem.java @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum SyncVoiceLibraryDtoProvidersItem { + ELEVEN_LABS("11labs"), + + AZURE("azure"), + + CARTESIA("cartesia"), + + CUSTOM_VOICE("custom-voice"), + + DEEPGRAM("deepgram"), + + LMNT("lmnt"), + + NEETS("neets"), + + OPENAI("openai"), + + PLAYHT("playht"), + + RIME_AI("rime-ai"); + + private final String value; + + SyncVoiceLibraryDtoProvidersItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/SystemMessage.java b/src/main/java/com/vapi/api/types/SystemMessage.java new file mode 100644 index 0000000..deac695 --- /dev/null +++ b/src/main/java/com/vapi/api/types/SystemMessage.java @@ -0,0 +1,205 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = SystemMessage.Builder.class) +public final class SystemMessage { + private final String role; + + private final String message; + + private final double time; + + private final double secondsFromStart; + + private final Map additionalProperties; + + private SystemMessage( + String role, + String message, + double time, + double secondsFromStart, + Map additionalProperties) { + this.role = role; + this.message = message; + this.time = time; + this.secondsFromStart = secondsFromStart; + this.additionalProperties = additionalProperties; + } + + /** + * @return The role of the system in the conversation. + */ + @JsonProperty("role") + public String getRole() { + return role; + } + + /** + * @return The message content from the system. + */ + @JsonProperty("message") + public String getMessage() { + return message; + } + + /** + * @return The timestamp when the message was sent. + */ + @JsonProperty("time") + public double getTime() { + return time; + } + + /** + * @return The number of seconds from the start of the conversation. + */ + @JsonProperty("secondsFromStart") + public double getSecondsFromStart() { + return secondsFromStart; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SystemMessage && equalTo((SystemMessage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(SystemMessage other) { + return role.equals(other.role) + && message.equals(other.message) + && time == other.time + && secondsFromStart == other.secondsFromStart; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.role, this.message, this.time, this.secondsFromStart); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RoleStage builder() { + return new Builder(); + } + + public interface RoleStage { + MessageStage role(@NotNull String role); + + Builder from(SystemMessage other); + } + + public interface MessageStage { + TimeStage message(@NotNull String message); + } + + public interface TimeStage { + SecondsFromStartStage time(double time); + } + + public interface SecondsFromStartStage { + _FinalStage secondsFromStart(double secondsFromStart); + } + + public interface _FinalStage { + SystemMessage build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements RoleStage, MessageStage, TimeStage, SecondsFromStartStage, _FinalStage { + private String role; + + private String message; + + private double time; + + private double secondsFromStart; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(SystemMessage other) { + role(other.getRole()); + message(other.getMessage()); + time(other.getTime()); + secondsFromStart(other.getSecondsFromStart()); + return this; + } + + /** + *

The role of the system in the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("role") + public MessageStage role(@NotNull String role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + /** + *

The message content from the system.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message") + public TimeStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + /** + *

The timestamp when the message was sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("time") + public SecondsFromStartStage time(double time) { + this.time = time; + return this; + } + + /** + *

The number of seconds from the start of the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("secondsFromStart") + public _FinalStage secondsFromStart(double secondsFromStart) { + this.secondsFromStart = secondsFromStart; + return this; + } + + @java.lang.Override + public SystemMessage build() { + return new SystemMessage(role, message, time, secondsFromStart, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TalkscriberTranscriber.java b/src/main/java/com/vapi/api/types/TalkscriberTranscriber.java new file mode 100644 index 0000000..b930cd2 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TalkscriberTranscriber.java @@ -0,0 +1,126 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TalkscriberTranscriber.Builder.class) +public final class TalkscriberTranscriber { + private final Optional model; + + private final Optional language; + + private final Map additionalProperties; + + private TalkscriberTranscriber( + Optional model, + Optional language, + Map additionalProperties) { + this.model = model; + this.language = language; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the model that will be used for the transcription. + */ + @JsonProperty("model") + public Optional getModel() { + return model; + } + + /** + * @return This is the language that will be set for the transcription. The list of languages Whisper supports can be found here: https://github.com/openai/whisper/blob/main/whisper/tokenizer.py + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TalkscriberTranscriber && equalTo((TalkscriberTranscriber) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TalkscriberTranscriber other) { + return model.equals(other.model) && language.equals(other.language); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.model, this.language); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional model = Optional.empty(); + + private Optional language = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TalkscriberTranscriber other) { + model(other.getModel()); + language(other.getLanguage()); + return this; + } + + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public Builder model(Optional model) { + this.model = model; + return this; + } + + public Builder model(String model) { + this.model = Optional.ofNullable(model); + return this; + } + + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public Builder language(Optional language) { + this.language = language; + return this; + } + + public Builder language(TalkscriberTranscriberLanguage language) { + this.language = Optional.ofNullable(language); + return this; + } + + public TalkscriberTranscriber build() { + return new TalkscriberTranscriber(model, language, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TalkscriberTranscriberLanguage.java b/src/main/java/com/vapi/api/types/TalkscriberTranscriberLanguage.java new file mode 100644 index 0000000..802c2e6 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TalkscriberTranscriberLanguage.java @@ -0,0 +1,220 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum TalkscriberTranscriberLanguage { + EN("en"), + + ZH("zh"), + + DE("de"), + + ES("es"), + + RU("ru"), + + KO("ko"), + + FR("fr"), + + JA("ja"), + + PT("pt"), + + TR("tr"), + + PL("pl"), + + CA("ca"), + + NL("nl"), + + AR("ar"), + + SV("sv"), + + IT("it"), + + ID("id"), + + HI("hi"), + + FI("fi"), + + VI("vi"), + + HE("he"), + + UK("uk"), + + EL("el"), + + MS("ms"), + + CS("cs"), + + RO("ro"), + + DA("da"), + + HU("hu"), + + TA("ta"), + + NO("no"), + + TH("th"), + + UR("ur"), + + HR("hr"), + + BG("bg"), + + LT("lt"), + + LA("la"), + + MI("mi"), + + ML("ml"), + + CY("cy"), + + SK("sk"), + + TE("te"), + + FA("fa"), + + LV("lv"), + + BN("bn"), + + SR("sr"), + + AZ("az"), + + SL("sl"), + + KN("kn"), + + ET("et"), + + MK("mk"), + + BR("br"), + + EU("eu"), + + IS("is"), + + HY("hy"), + + NE("ne"), + + MN("mn"), + + BS("bs"), + + KK("kk"), + + SQ("sq"), + + SW("sw"), + + GL("gl"), + + MR("mr"), + + PA("pa"), + + SI("si"), + + KM("km"), + + SN("sn"), + + YO("yo"), + + SO("so"), + + AF("af"), + + OC("oc"), + + KA("ka"), + + BE("be"), + + TG("tg"), + + SD("sd"), + + GU("gu"), + + AM("am"), + + YI("yi"), + + LO("lo"), + + UZ("uz"), + + FO("fo"), + + HT("ht"), + + PS("ps"), + + TK("tk"), + + NN("nn"), + + MT("mt"), + + SA("sa"), + + LB("lb"), + + MY("my"), + + BO("bo"), + + TL("tl"), + + MG("mg"), + + AS("as"), + + TT("tt"), + + HAW("haw"), + + LN("ln"), + + HA("ha"), + + BA("ba"), + + JW("jw"), + + SU("su"), + + YUE("yue"); + + private final String value; + + TalkscriberTranscriberLanguage(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/Template.java b/src/main/java/com/vapi/api/types/Template.java new file mode 100644 index 0000000..ecc476c --- /dev/null +++ b/src/main/java/com/vapi/api/types/Template.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Template.Builder.class) +public final class Template { + private final Optional details; + + private final Optional providerDetails; + + private final Optional metadata; + + private final Optional visibility; + + private final Optional name; + + private final Optional provider; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private Template( + Optional details, + Optional providerDetails, + Optional metadata, + Optional visibility, + Optional name, + Optional provider, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.details = details; + this.providerDetails = providerDetails; + this.metadata = metadata; + this.visibility = visibility; + this.name = name; + this.provider = provider; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("details") + public Optional getDetails() { + return details; + } + + @JsonProperty("providerDetails") + public Optional getProviderDetails() { + return providerDetails; + } + + @JsonProperty("metadata") + public Optional getMetadata() { + return metadata; + } + + @JsonProperty("visibility") + public Optional getVisibility() { + return visibility; + } + + @JsonProperty("type") + public String getType() { + return "tool"; + } + + /** + * @return The name of the template. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("provider") + public Optional getProvider() { + return provider; + } + + /** + * @return The unique identifier for the template. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The unique identifier for the organization that this template belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return The ISO 8601 date-time string of when the template was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The ISO 8601 date-time string of when the template was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Template && equalTo((Template) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Template other) { + return details.equals(other.details) + && providerDetails.equals(other.providerDetails) + && metadata.equals(other.metadata) + && visibility.equals(other.visibility) + && name.equals(other.name) + && provider.equals(other.provider) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.details, + this.providerDetails, + this.metadata, + this.visibility, + this.name, + this.provider, + this.id, + this.orgId, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(Template other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + Template build(); + + _FinalStage details(Optional details); + + _FinalStage details(TemplateDetails details); + + _FinalStage providerDetails(Optional providerDetails); + + _FinalStage providerDetails(TemplateProviderDetails providerDetails); + + _FinalStage metadata(Optional metadata); + + _FinalStage metadata(ToolTemplateMetadata metadata); + + _FinalStage visibility(Optional visibility); + + _FinalStage visibility(TemplateVisibility visibility); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage provider(Optional provider); + + _FinalStage provider(TemplateProvider provider); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional provider = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional visibility = Optional.empty(); + + private Optional metadata = Optional.empty(); + + private Optional providerDetails = Optional.empty(); + + private Optional details = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Template other) { + details(other.getDetails()); + providerDetails(other.getProviderDetails()); + metadata(other.getMetadata()); + visibility(other.getVisibility()); + name(other.getName()); + provider(other.getProvider()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

The unique identifier for the template.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The unique identifier for the organization that this template belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

The ISO 8601 date-time string of when the template was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The ISO 8601 date-time string of when the template was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage provider(TemplateProvider provider) { + this.provider = Optional.ofNullable(provider); + return this; + } + + @java.lang.Override + @JsonSetter(value = "provider", nulls = Nulls.SKIP) + public _FinalStage provider(Optional provider) { + this.provider = provider; + return this; + } + + /** + *

The name of the template. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public _FinalStage visibility(TemplateVisibility visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + @java.lang.Override + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public _FinalStage visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + @java.lang.Override + public _FinalStage metadata(ToolTemplateMetadata metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional metadata) { + this.metadata = metadata; + return this; + } + + @java.lang.Override + public _FinalStage providerDetails(TemplateProviderDetails providerDetails) { + this.providerDetails = Optional.ofNullable(providerDetails); + return this; + } + + @java.lang.Override + @JsonSetter(value = "providerDetails", nulls = Nulls.SKIP) + public _FinalStage providerDetails(Optional providerDetails) { + this.providerDetails = providerDetails; + return this; + } + + @java.lang.Override + public _FinalStage details(TemplateDetails details) { + this.details = Optional.ofNullable(details); + return this; + } + + @java.lang.Override + @JsonSetter(value = "details", nulls = Nulls.SKIP) + public _FinalStage details(Optional details) { + this.details = details; + return this; + } + + @java.lang.Override + public Template build() { + return new Template( + details, + providerDetails, + metadata, + visibility, + name, + provider, + id, + orgId, + createdAt, + updatedAt, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TemplateDetails.java b/src/main/java/com/vapi/api/types/TemplateDetails.java new file mode 100644 index 0000000..ed813cd --- /dev/null +++ b/src/main/java/com/vapi/api/types/TemplateDetails.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class TemplateDetails { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private TemplateDetails(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static TemplateDetails dtmf(CreateDtmfToolDto value) { + return new TemplateDetails(new DtmfValue(value)); + } + + public static TemplateDetails endCall(CreateEndCallToolDto value) { + return new TemplateDetails(new EndCallValue(value)); + } + + public static TemplateDetails voicemail(CreateVoicemailToolDto value) { + return new TemplateDetails(new VoicemailValue(value)); + } + + public static TemplateDetails function(CreateFunctionToolDto value) { + return new TemplateDetails(new FunctionValue(value)); + } + + public static TemplateDetails ghl(CreateGhlToolDto value) { + return new TemplateDetails(new GhlValue(value)); + } + + public static TemplateDetails make(CreateMakeToolDto value) { + return new TemplateDetails(new MakeValue(value)); + } + + public static TemplateDetails transferCall(CreateTransferCallToolDto value) { + return new TemplateDetails(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TemplateDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TemplateDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TemplateDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TemplateDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TemplateDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TemplateDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TemplateDetails{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "TemplateDetails{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/TemplateProvider.java b/src/main/java/com/vapi/api/types/TemplateProvider.java new file mode 100644 index 0000000..5b4ece2 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TemplateProvider.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum TemplateProvider { + MAKE("make"), + + GOHIGHLEVEL("gohighlevel"), + + FUNCTION("function"); + + private final String value; + + TemplateProvider(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/TemplateProviderDetails.java b/src/main/java/com/vapi/api/types/TemplateProviderDetails.java new file mode 100644 index 0000000..2373c30 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TemplateProviderDetails.java @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class TemplateProviderDetails { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private TemplateProviderDetails(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static TemplateProviderDetails make(MakeToolProviderDetails value) { + return new TemplateProviderDetails(new MakeValue(value)); + } + + public static TemplateProviderDetails ghl(GhlToolProviderDetails value) { + return new TemplateProviderDetails(new GhlValue(value)); + } + + public static TemplateProviderDetails function(FunctionToolProviderDetails value) { + return new TemplateProviderDetails(new FunctionValue(value)); + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitMake(MakeToolProviderDetails make); + + T visitGhl(GhlToolProviderDetails ghl); + + T visitFunction(FunctionToolProviderDetails function); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(FunctionValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private MakeToolProviderDetails value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(MakeToolProviderDetails value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TemplateProviderDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private GhlToolProviderDetails value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(GhlToolProviderDetails value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TemplateProviderDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private FunctionToolProviderDetails value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(FunctionToolProviderDetails value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TemplateProviderDetails{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "TemplateProviderDetails{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/TemplateVisibility.java b/src/main/java/com/vapi/api/types/TemplateVisibility.java new file mode 100644 index 0000000..4deacf4 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TemplateVisibility.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum TemplateVisibility { + PUBLIC("public"), + + PRIVATE("private"); + + private final String value; + + TemplateVisibility(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/TimeRange.java b/src/main/java/com/vapi/api/types/TimeRange.java new file mode 100644 index 0000000..6bfab97 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TimeRange.java @@ -0,0 +1,186 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TimeRange.Builder.class) +public final class TimeRange { + private final Optional step; + + private final Optional start; + + private final Optional end; + + private final Optional timezone; + + private final Map additionalProperties; + + private TimeRange( + Optional step, + Optional start, + Optional end, + Optional timezone, + Map additionalProperties) { + this.step = step; + this.start = start; + this.end = end; + this.timezone = timezone; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the time step for aggregations. + *

If not provided, defaults to returning for the entire time range.

+ */ + @JsonProperty("step") + public Optional getStep() { + return step; + } + + /** + * @return This is the start date for the time range. + *

If not provided, defaults to the 7 days ago.

+ */ + @JsonProperty("start") + public Optional getStart() { + return start; + } + + /** + * @return This is the end date for the time range. + *

If not provided, defaults to now.

+ */ + @JsonProperty("end") + public Optional getEnd() { + return end; + } + + /** + * @return This is the timezone you want to set for the query. + *

If not provided, defaults to UTC.

+ */ + @JsonProperty("timezone") + public Optional getTimezone() { + return timezone; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TimeRange && equalTo((TimeRange) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TimeRange other) { + return step.equals(other.step) + && start.equals(other.start) + && end.equals(other.end) + && timezone.equals(other.timezone); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.step, this.start, this.end, this.timezone); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional step = Optional.empty(); + + private Optional start = Optional.empty(); + + private Optional end = Optional.empty(); + + private Optional timezone = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TimeRange other) { + step(other.getStep()); + start(other.getStart()); + end(other.getEnd()); + timezone(other.getTimezone()); + return this; + } + + @JsonSetter(value = "step", nulls = Nulls.SKIP) + public Builder step(Optional step) { + this.step = step; + return this; + } + + public Builder step(TimeRangeStep step) { + this.step = Optional.ofNullable(step); + return this; + } + + @JsonSetter(value = "start", nulls = Nulls.SKIP) + public Builder start(Optional start) { + this.start = start; + return this; + } + + public Builder start(OffsetDateTime start) { + this.start = Optional.ofNullable(start); + return this; + } + + @JsonSetter(value = "end", nulls = Nulls.SKIP) + public Builder end(Optional end) { + this.end = end; + return this; + } + + public Builder end(OffsetDateTime end) { + this.end = Optional.ofNullable(end); + return this; + } + + @JsonSetter(value = "timezone", nulls = Nulls.SKIP) + public Builder timezone(Optional timezone) { + this.timezone = timezone; + return this; + } + + public Builder timezone(String timezone) { + this.timezone = Optional.ofNullable(timezone); + return this; + } + + public TimeRange build() { + return new TimeRange(step, start, end, timezone, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TimeRangeStep.java b/src/main/java/com/vapi/api/types/TimeRangeStep.java new file mode 100644 index 0000000..fd49b28 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TimeRangeStep.java @@ -0,0 +1,40 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum TimeRangeStep { + MINUTE("minute"), + + HOUR("hour"), + + DAY("day"), + + WEEK("week"), + + MONTH("month"), + + QUARTER("quarter"), + + YEAR("year"), + + DECADE("decade"), + + CENTURY("century"), + + MILLENNIUM("millennium"); + + private final String value; + + TimeRangeStep(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/TogetherAiCredential.java b/src/main/java/com/vapi/api/types/TogetherAiCredential.java new file mode 100644 index 0000000..8d9ab5b --- /dev/null +++ b/src/main/java/com/vapi/api/types/TogetherAiCredential.java @@ -0,0 +1,242 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TogetherAiCredential.Builder.class) +public final class TogetherAiCredential { + private final String apiKey; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private TogetherAiCredential( + String apiKey, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.apiKey = apiKey; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "together-ai"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TogetherAiCredential && equalTo((TogetherAiCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TogetherAiCredential other) { + return apiKey.equals(other.apiKey) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.id, this.orgId, this.createdAt, this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + IdStage apiKey(@NotNull String apiKey); + + Builder from(TogetherAiCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + TogetherAiCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements ApiKeyStage, IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String apiKey; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TogetherAiCredential other) { + apiKey(other.getApiKey()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public IdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + public TogetherAiCredential build() { + return new TogetherAiCredential(apiKey, id, orgId, createdAt, updatedAt, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TogetherAiModel.java b/src/main/java/com/vapi/api/types/TogetherAiModel.java new file mode 100644 index 0000000..c663ccf --- /dev/null +++ b/src/main/java/com/vapi/api/types/TogetherAiModel.java @@ -0,0 +1,441 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TogetherAiModel.Builder.class) +public final class TogetherAiModel { + private final Optional> messages; + + private final Optional> tools; + + private final Optional> toolIds; + + private final String model; + + private final Optional temperature; + + private final Optional knowledgeBase; + + private final Optional maxTokens; + + private final Optional emotionRecognitionEnabled; + + private final Optional numFastTurns; + + private final Map additionalProperties; + + private TogetherAiModel( + Optional> messages, + Optional> tools, + Optional> toolIds, + String model, + Optional temperature, + Optional knowledgeBase, + Optional maxTokens, + Optional emotionRecognitionEnabled, + Optional numFastTurns, + Map additionalProperties) { + this.messages = messages; + this.tools = tools; + this.toolIds = toolIds; + this.model = model; + this.temperature = temperature; + this.knowledgeBase = knowledgeBase; + this.maxTokens = maxTokens; + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + this.numFastTurns = numFastTurns; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the starting state for the conversation. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return These are the tools that the assistant can use during the call. To use existing tools, use toolIds. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("tools") + public Optional> getTools() { + return tools; + } + + /** + * @return These are the tools that the assistant can use during the call. To use transient tools, use tools. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("toolIds") + public Optional> getToolIds() { + return toolIds; + } + + /** + * @return This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + */ + @JsonProperty("model") + public String getModel() { + return model; + } + + /** + * @return This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + */ + @JsonProperty("temperature") + public Optional getTemperature() { + return temperature; + } + + /** + * @return These are the options for the knowledge base. + */ + @JsonProperty("knowledgeBase") + public Optional getKnowledgeBase() { + return knowledgeBase; + } + + /** + * @return This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. + */ + @JsonProperty("maxTokens") + public Optional getMaxTokens() { + return maxTokens; + } + + /** + * @return This determines whether we detect user's emotion while they speak and send it as an additional info to model. + *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ */ + @JsonProperty("emotionRecognitionEnabled") + public Optional getEmotionRecognitionEnabled() { + return emotionRecognitionEnabled; + } + + /** + * @return This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai. + *

Default is 0.

+ *

@default 0

+ */ + @JsonProperty("numFastTurns") + public Optional getNumFastTurns() { + return numFastTurns; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TogetherAiModel && equalTo((TogetherAiModel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TogetherAiModel other) { + return messages.equals(other.messages) + && tools.equals(other.tools) + && toolIds.equals(other.toolIds) + && model.equals(other.model) + && temperature.equals(other.temperature) + && knowledgeBase.equals(other.knowledgeBase) + && maxTokens.equals(other.maxTokens) + && emotionRecognitionEnabled.equals(other.emotionRecognitionEnabled) + && numFastTurns.equals(other.numFastTurns); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.messages, + this.tools, + this.toolIds, + this.model, + this.temperature, + this.knowledgeBase, + this.maxTokens, + this.emotionRecognitionEnabled, + this.numFastTurns); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + _FinalStage model(@NotNull String model); + + Builder from(TogetherAiModel other); + } + + public interface _FinalStage { + TogetherAiModel build(); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage tools(Optional> tools); + + _FinalStage tools(List tools); + + _FinalStage toolIds(Optional> toolIds); + + _FinalStage toolIds(List toolIds); + + _FinalStage temperature(Optional temperature); + + _FinalStage temperature(Double temperature); + + _FinalStage knowledgeBase(Optional knowledgeBase); + + _FinalStage knowledgeBase(KnowledgeBase knowledgeBase); + + _FinalStage maxTokens(Optional maxTokens); + + _FinalStage maxTokens(Double maxTokens); + + _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled); + + _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled); + + _FinalStage numFastTurns(Optional numFastTurns); + + _FinalStage numFastTurns(Double numFastTurns); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, _FinalStage { + private String model; + + private Optional numFastTurns = Optional.empty(); + + private Optional emotionRecognitionEnabled = Optional.empty(); + + private Optional maxTokens = Optional.empty(); + + private Optional knowledgeBase = Optional.empty(); + + private Optional temperature = Optional.empty(); + + private Optional> toolIds = Optional.empty(); + + private Optional> tools = Optional.empty(); + + private Optional> messages = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TogetherAiModel other) { + messages(other.getMessages()); + tools(other.getTools()); + toolIds(other.getToolIds()); + model(other.getModel()); + temperature(other.getTemperature()); + knowledgeBase(other.getKnowledgeBase()); + maxTokens(other.getMaxTokens()); + emotionRecognitionEnabled(other.getEmotionRecognitionEnabled()); + numFastTurns(other.getNumFastTurns()); + return this; + } + + /** + *

This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("model") + public _FinalStage model(@NotNull String model) { + this.model = Objects.requireNonNull(model, "model must not be null"); + return this; + } + + /** + *

This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai.

+ *

Default is 0.

+ *

@default 0

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numFastTurns(Double numFastTurns) { + this.numFastTurns = Optional.ofNullable(numFastTurns); + return this; + } + + @java.lang.Override + @JsonSetter(value = "numFastTurns", nulls = Nulls.SKIP) + public _FinalStage numFastTurns(Optional numFastTurns) { + this.numFastTurns = numFastTurns; + return this; + } + + /** + *

This determines whether we detect user's emotion while they speak and send it as an additional info to model.

+ *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = Optional.ofNullable(emotionRecognitionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "emotionRecognitionEnabled", nulls = Nulls.SKIP) + public _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + return this; + } + + /** + *

This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxTokens(Double maxTokens) { + this.maxTokens = Optional.ofNullable(maxTokens); + return this; + } + + @java.lang.Override + @JsonSetter(value = "maxTokens", nulls = Nulls.SKIP) + public _FinalStage maxTokens(Optional maxTokens) { + this.maxTokens = maxTokens; + return this; + } + + /** + *

These are the options for the knowledge base.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage knowledgeBase(KnowledgeBase knowledgeBase) { + this.knowledgeBase = Optional.ofNullable(knowledgeBase); + return this; + } + + @java.lang.Override + @JsonSetter(value = "knowledgeBase", nulls = Nulls.SKIP) + public _FinalStage knowledgeBase(Optional knowledgeBase) { + this.knowledgeBase = knowledgeBase; + return this; + } + + /** + *

This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage temperature(Double temperature) { + this.temperature = Optional.ofNullable(temperature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "temperature", nulls = Nulls.SKIP) + public _FinalStage temperature(Optional temperature) { + this.temperature = temperature; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use transient tools, use tools.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toolIds(List toolIds) { + this.toolIds = Optional.ofNullable(toolIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "toolIds", nulls = Nulls.SKIP) + public _FinalStage toolIds(Optional> toolIds) { + this.toolIds = toolIds; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use existing tools, use toolIds.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tools(List tools) { + this.tools = Optional.ofNullable(tools); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tools", nulls = Nulls.SKIP) + public _FinalStage tools(Optional> tools) { + this.tools = tools; + return this; + } + + /** + *

This is the starting state for the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + @java.lang.Override + public TogetherAiModel build() { + return new TogetherAiModel( + messages, + tools, + toolIds, + model, + temperature, + knowledgeBase, + maxTokens, + emotionRecognitionEnabled, + numFastTurns, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TogetherAiModelToolsItem.java b/src/main/java/com/vapi/api/types/TogetherAiModelToolsItem.java new file mode 100644 index 0000000..3d493b6 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TogetherAiModelToolsItem.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class TogetherAiModelToolsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private TogetherAiModelToolsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static TogetherAiModelToolsItem dtmf(CreateDtmfToolDto value) { + return new TogetherAiModelToolsItem(new DtmfValue(value)); + } + + public static TogetherAiModelToolsItem endCall(CreateEndCallToolDto value) { + return new TogetherAiModelToolsItem(new EndCallValue(value)); + } + + public static TogetherAiModelToolsItem voicemail(CreateVoicemailToolDto value) { + return new TogetherAiModelToolsItem(new VoicemailValue(value)); + } + + public static TogetherAiModelToolsItem function(CreateFunctionToolDto value) { + return new TogetherAiModelToolsItem(new FunctionValue(value)); + } + + public static TogetherAiModelToolsItem ghl(CreateGhlToolDto value) { + return new TogetherAiModelToolsItem(new GhlValue(value)); + } + + public static TogetherAiModelToolsItem make(CreateMakeToolDto value) { + return new TogetherAiModelToolsItem(new MakeValue(value)); + } + + public static TogetherAiModelToolsItem transferCall(CreateTransferCallToolDto value) { + return new TogetherAiModelToolsItem(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TogetherAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TogetherAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TogetherAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TogetherAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TogetherAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TogetherAiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TogetherAiModelToolsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "TogetherAiModelToolsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/Token.java b/src/main/java/com/vapi/api/types/Token.java new file mode 100644 index 0000000..0f7b547 --- /dev/null +++ b/src/main/java/com/vapi/api/types/Token.java @@ -0,0 +1,358 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Token.Builder.class) +public final class Token { + private final Optional tag; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final String value; + + private final Optional name; + + private final Optional restrictions; + + private final Map additionalProperties; + + private Token( + Optional tag, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + String value, + Optional name, + Optional restrictions, + Map additionalProperties) { + this.tag = tag; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.value = value; + this.name = name; + this.restrictions = restrictions; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the tag for the token. It represents its scope. + */ + @JsonProperty("tag") + public Optional getTag() { + return tag; + } + + /** + * @return This is the unique identifier for the token. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is unique identifier for the org that this token belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the token was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the token was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the token key. + */ + @JsonProperty("value") + public String getValue() { + return value; + } + + /** + * @return This is the name of the token. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This are the restrictions for the token. + */ + @JsonProperty("restrictions") + public Optional getRestrictions() { + return restrictions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Token && equalTo((Token) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Token other) { + return tag.equals(other.tag) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && value.equals(other.value) + && name.equals(other.name) + && restrictions.equals(other.restrictions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.tag, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.value, + this.name, + this.restrictions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(Token other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + ValueStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface ValueStage { + _FinalStage value(@NotNull String value); + } + + public interface _FinalStage { + Token build(); + + _FinalStage tag(Optional tag); + + _FinalStage tag(TokenTag tag); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage restrictions(Optional restrictions); + + _FinalStage restrictions(TokenRestrictions restrictions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, ValueStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private String value; + + private Optional restrictions = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional tag = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Token other) { + tag(other.getTag()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + value(other.getValue()); + name(other.getName()); + restrictions(other.getRestrictions()); + return this; + } + + /** + *

This is the unique identifier for the token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is unique identifier for the org that this token belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the token was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the token was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public ValueStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the token key.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(@NotNull String value) { + this.value = Objects.requireNonNull(value, "value must not be null"); + return this; + } + + /** + *

This are the restrictions for the token.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage restrictions(TokenRestrictions restrictions) { + this.restrictions = Optional.ofNullable(restrictions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "restrictions", nulls = Nulls.SKIP) + public _FinalStage restrictions(Optional restrictions) { + this.restrictions = restrictions; + return this; + } + + /** + *

This is the name of the token. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the tag for the token. It represents its scope.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tag(TokenTag tag) { + this.tag = Optional.ofNullable(tag); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tag", nulls = Nulls.SKIP) + public _FinalStage tag(Optional tag) { + this.tag = tag; + return this; + } + + @java.lang.Override + public Token build() { + return new Token(tag, id, orgId, createdAt, updatedAt, value, name, restrictions, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TokenRestrictions.java b/src/main/java/com/vapi/api/types/TokenRestrictions.java new file mode 100644 index 0000000..d69c613 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TokenRestrictions.java @@ -0,0 +1,187 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TokenRestrictions.Builder.class) +public final class TokenRestrictions { + private final Optional enabled; + + private final Optional> allowedOrigins; + + private final Optional> allowedAssistantIds; + + private final Optional allowTransientAssistant; + + private final Map additionalProperties; + + private TokenRestrictions( + Optional enabled, + Optional> allowedOrigins, + Optional> allowedAssistantIds, + Optional allowTransientAssistant, + Map additionalProperties) { + this.enabled = enabled; + this.allowedOrigins = allowedOrigins; + this.allowedAssistantIds = allowedAssistantIds; + this.allowTransientAssistant = allowTransientAssistant; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines whether the token is enabled or disabled. Default is true, it's enabled. + */ + @JsonProperty("enabled") + public Optional getEnabled() { + return enabled; + } + + /** + * @return This determines the allowed origins for this token. Validates the Origin header. Default is any origin. + *

Only relevant for public tokens.

+ */ + @JsonProperty("allowedOrigins") + public Optional> getAllowedOrigins() { + return allowedOrigins; + } + + /** + * @return This determines which assistantIds can be used when creating a call. Default is any assistantId. + *

Only relevant for public tokens.

+ */ + @JsonProperty("allowedAssistantIds") + public Optional> getAllowedAssistantIds() { + return allowedAssistantIds; + } + + /** + * @return This determines whether transient assistants can be used when creating a call. Default is true. + *

If allowedAssistantIds is provided, this is automatically false.

+ *

Only relevant for public tokens.

+ */ + @JsonProperty("allowTransientAssistant") + public Optional getAllowTransientAssistant() { + return allowTransientAssistant; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TokenRestrictions && equalTo((TokenRestrictions) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TokenRestrictions other) { + return enabled.equals(other.enabled) + && allowedOrigins.equals(other.allowedOrigins) + && allowedAssistantIds.equals(other.allowedAssistantIds) + && allowTransientAssistant.equals(other.allowTransientAssistant); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.enabled, this.allowedOrigins, this.allowedAssistantIds, this.allowTransientAssistant); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional enabled = Optional.empty(); + + private Optional> allowedOrigins = Optional.empty(); + + private Optional> allowedAssistantIds = Optional.empty(); + + private Optional allowTransientAssistant = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TokenRestrictions other) { + enabled(other.getEnabled()); + allowedOrigins(other.getAllowedOrigins()); + allowedAssistantIds(other.getAllowedAssistantIds()); + allowTransientAssistant(other.getAllowTransientAssistant()); + return this; + } + + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(Boolean enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + @JsonSetter(value = "allowedOrigins", nulls = Nulls.SKIP) + public Builder allowedOrigins(Optional> allowedOrigins) { + this.allowedOrigins = allowedOrigins; + return this; + } + + public Builder allowedOrigins(List allowedOrigins) { + this.allowedOrigins = Optional.ofNullable(allowedOrigins); + return this; + } + + @JsonSetter(value = "allowedAssistantIds", nulls = Nulls.SKIP) + public Builder allowedAssistantIds(Optional> allowedAssistantIds) { + this.allowedAssistantIds = allowedAssistantIds; + return this; + } + + public Builder allowedAssistantIds(List allowedAssistantIds) { + this.allowedAssistantIds = Optional.ofNullable(allowedAssistantIds); + return this; + } + + @JsonSetter(value = "allowTransientAssistant", nulls = Nulls.SKIP) + public Builder allowTransientAssistant(Optional allowTransientAssistant) { + this.allowTransientAssistant = allowTransientAssistant; + return this; + } + + public Builder allowTransientAssistant(Boolean allowTransientAssistant) { + this.allowTransientAssistant = Optional.ofNullable(allowTransientAssistant); + return this; + } + + public TokenRestrictions build() { + return new TokenRestrictions( + enabled, allowedOrigins, allowedAssistantIds, allowTransientAssistant, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TokenTag.java b/src/main/java/com/vapi/api/types/TokenTag.java new file mode 100644 index 0000000..37b58d0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TokenTag.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum TokenTag { + PRIVATE("private"), + + PUBLIC("public"); + + private final String value; + + TokenTag(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ToolCall.java b/src/main/java/com/vapi/api/types/ToolCall.java new file mode 100644 index 0000000..6be9dd2 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolCall.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ToolCall.Builder.class) +public final class ToolCall { + private final ToolCallFunction function; + + private final String id; + + private final Map additionalProperties; + + private ToolCall(ToolCallFunction function, String id, Map additionalProperties) { + this.function = function; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the type of tool the model called. + */ + @JsonProperty("type") + public String getType() { + return "function"; + } + + /** + * @return This is the function the model called. + */ + @JsonProperty("function") + public ToolCallFunction getFunction() { + return function; + } + + /** + * @return This is the unique identifier for the tool call. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCall && equalTo((ToolCall) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ToolCall other) { + return function.equals(other.function) && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.function, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static FunctionStage builder() { + return new Builder(); + } + + public interface FunctionStage { + IdStage function(@NotNull ToolCallFunction function); + + Builder from(ToolCall other); + } + + public interface IdStage { + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + ToolCall build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements FunctionStage, IdStage, _FinalStage { + private ToolCallFunction function; + + private String id; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ToolCall other) { + function(other.getFunction()); + id(other.getId()); + return this; + } + + /** + *

This is the function the model called.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("function") + public IdStage function(@NotNull ToolCallFunction function) { + this.function = Objects.requireNonNull(function, "function must not be null"); + return this; + } + + /** + *

This is the unique identifier for the tool call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + @java.lang.Override + public ToolCall build() { + return new ToolCall(function, id, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ToolCallBlock.java b/src/main/java/com/vapi/api/types/ToolCallBlock.java new file mode 100644 index 0000000..3f17846 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolCallBlock.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ToolCallBlock.Builder.class) +public final class ToolCallBlock { + private final Optional> messages; + + private final Optional inputSchema; + + private final Optional outputSchema; + + private final Optional tool; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional name; + + private final Optional toolId; + + private final Map additionalProperties; + + private ToolCallBlock( + Optional> messages, + Optional inputSchema, + Optional outputSchema, + Optional tool, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional name, + Optional toolId, + Map additionalProperties) { + this.messages = messages; + this.inputSchema = inputSchema; + this.outputSchema = outputSchema; + this.tool = tool; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.name = name; + this.toolId = toolId; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the pre-configured messages that will be spoken to the user while the block is running. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the input schema for the block. This is the input the block needs to run. It's given to the block as steps[0].input + *

These are accessible as variables:

+ *
    + *
  • ({{input.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.input.propertyName}}) in context of the workflow
  • + *
+ */ + @JsonProperty("inputSchema") + public Optional getInputSchema() { + return inputSchema; + } + + /** + * @return This is the output schema for the block. This is the output the block will return to the workflow ({{stepName.output}}). + *

These are accessible as variables:

+ *
    + *
  • ({{output.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
  • + *
  • ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2)
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ */ + @JsonProperty("outputSchema") + public Optional getOutputSchema() { + return outputSchema; + } + + /** + * @return This is the tool that the block will call. To use an existing tool, use toolId. + */ + @JsonProperty("tool") + public Optional getTool() { + return tool; + } + + /** + * @return This is the unique identifier for the block. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the organization that this block belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the block was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the block was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the name of the block. This is just for your reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the id of the tool that the block will call. To use a transient tool, use tool. + */ + @JsonProperty("toolId") + public Optional getToolId() { + return toolId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallBlock && equalTo((ToolCallBlock) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ToolCallBlock other) { + return messages.equals(other.messages) + && inputSchema.equals(other.inputSchema) + && outputSchema.equals(other.outputSchema) + && tool.equals(other.tool) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && name.equals(other.name) + && toolId.equals(other.toolId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.messages, + this.inputSchema, + this.outputSchema, + this.tool, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.name, + this.toolId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(ToolCallBlock other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + ToolCallBlock build(); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage inputSchema(Optional inputSchema); + + _FinalStage inputSchema(JsonSchema inputSchema); + + _FinalStage outputSchema(Optional outputSchema); + + _FinalStage outputSchema(JsonSchema outputSchema); + + _FinalStage tool(Optional tool); + + _FinalStage tool(ToolCallBlockTool tool); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage toolId(Optional toolId); + + _FinalStage toolId(String toolId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional toolId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional tool = Optional.empty(); + + private Optional outputSchema = Optional.empty(); + + private Optional inputSchema = Optional.empty(); + + private Optional> messages = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ToolCallBlock other) { + messages(other.getMessages()); + inputSchema(other.getInputSchema()); + outputSchema(other.getOutputSchema()); + tool(other.getTool()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + name(other.getName()); + toolId(other.getToolId()); + return this; + } + + /** + *

This is the unique identifier for the block.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the organization that this block belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the block was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the block was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the id of the tool that the block will call. To use a transient tool, use tool.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toolId(String toolId) { + this.toolId = Optional.ofNullable(toolId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "toolId", nulls = Nulls.SKIP) + public _FinalStage toolId(Optional toolId) { + this.toolId = toolId; + return this; + } + + /** + *

This is the name of the block. This is just for your reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the tool that the block will call. To use an existing tool, use toolId.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tool(ToolCallBlockTool tool) { + this.tool = Optional.ofNullable(tool); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tool", nulls = Nulls.SKIP) + public _FinalStage tool(Optional tool) { + this.tool = tool; + return this; + } + + /** + *

This is the output schema for the block. This is the output the block will return to the workflow ({{stepName.output}}).

+ *

These are accessible as variables:

+ *
    + *
  • ({{output.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
  • + *
  • ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2)
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage outputSchema(JsonSchema outputSchema) { + this.outputSchema = Optional.ofNullable(outputSchema); + return this; + } + + @java.lang.Override + @JsonSetter(value = "outputSchema", nulls = Nulls.SKIP) + public _FinalStage outputSchema(Optional outputSchema) { + this.outputSchema = outputSchema; + return this; + } + + /** + *

This is the input schema for the block. This is the input the block needs to run. It's given to the block as steps[0].input

+ *

These are accessible as variables:

+ *
    + *
  • ({{input.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.input.propertyName}}) in context of the workflow
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage inputSchema(JsonSchema inputSchema) { + this.inputSchema = Optional.ofNullable(inputSchema); + return this; + } + + @java.lang.Override + @JsonSetter(value = "inputSchema", nulls = Nulls.SKIP) + public _FinalStage inputSchema(Optional inputSchema) { + this.inputSchema = inputSchema; + return this; + } + + /** + *

These are the pre-configured messages that will be spoken to the user while the block is running.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + @java.lang.Override + public ToolCallBlock build() { + return new ToolCallBlock( + messages, + inputSchema, + outputSchema, + tool, + id, + orgId, + createdAt, + updatedAt, + name, + toolId, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ToolCallBlockMessagesItem.java b/src/main/java/com/vapi/api/types/ToolCallBlockMessagesItem.java new file mode 100644 index 0000000..115d8bb --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolCallBlockMessagesItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ToolCallBlockMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ToolCallBlockMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ToolCallBlockMessagesItem blockStart(BlockStartMessage value) { + return new ToolCallBlockMessagesItem(new BlockStartValue(value)); + } + + public static ToolCallBlockMessagesItem blockComplete(BlockCompleteMessage value) { + return new ToolCallBlockMessagesItem(new BlockCompleteValue(value)); + } + + public boolean isBlockStart() { + return value instanceof BlockStartValue; + } + + public boolean isBlockComplete() { + return value instanceof BlockCompleteValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getBlockStart() { + if (isBlockStart()) { + return Optional.of(((BlockStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getBlockComplete() { + if (isBlockComplete()) { + return Optional.of(((BlockCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitBlockStart(BlockStartMessage blockStart); + + T visitBlockComplete(BlockCompleteMessage blockComplete); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(BlockStartValue.class), @JsonSubTypes.Type(BlockCompleteValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("block-start") + private static final class BlockStartValue implements Value { + @JsonUnwrapped + private BlockStartMessage value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BlockStartValue() {} + + private BlockStartValue(BlockStartMessage value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBlockStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockStartValue && equalTo((BlockStartValue) other); + } + + private boolean equalTo(BlockStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolCallBlockMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("block-complete") + private static final class BlockCompleteValue implements Value { + @JsonUnwrapped + private BlockCompleteMessage value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BlockCompleteValue() {} + + private BlockCompleteValue(BlockCompleteMessage value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBlockComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockCompleteValue && equalTo((BlockCompleteValue) other); + } + + private boolean equalTo(BlockCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolCallBlockMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ToolCallBlockMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ToolCallBlockTool.java b/src/main/java/com/vapi/api/types/ToolCallBlockTool.java new file mode 100644 index 0000000..397f9e2 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolCallBlockTool.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ToolCallBlockTool { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ToolCallBlockTool(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ToolCallBlockTool dtmf(CreateDtmfToolDto value) { + return new ToolCallBlockTool(new DtmfValue(value)); + } + + public static ToolCallBlockTool endCall(CreateEndCallToolDto value) { + return new ToolCallBlockTool(new EndCallValue(value)); + } + + public static ToolCallBlockTool voicemail(CreateVoicemailToolDto value) { + return new ToolCallBlockTool(new VoicemailValue(value)); + } + + public static ToolCallBlockTool function(CreateFunctionToolDto value) { + return new ToolCallBlockTool(new FunctionValue(value)); + } + + public static ToolCallBlockTool ghl(CreateGhlToolDto value) { + return new ToolCallBlockTool(new GhlValue(value)); + } + + public static ToolCallBlockTool make(CreateMakeToolDto value) { + return new ToolCallBlockTool(new MakeValue(value)); + } + + public static ToolCallBlockTool transferCall(CreateTransferCallToolDto value) { + return new ToolCallBlockTool(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolCallBlockTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolCallBlockTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolCallBlockTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolCallBlockTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolCallBlockTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolCallBlockTool{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolCallBlockTool{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ToolCallBlockTool{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ToolCallFunction.java b/src/main/java/com/vapi/api/types/ToolCallFunction.java new file mode 100644 index 0000000..494f09d --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolCallFunction.java @@ -0,0 +1,159 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ToolCallFunction.Builder.class) +public final class ToolCallFunction { + private final String name; + + private final Map arguments; + + private final Map additionalProperties; + + private ToolCallFunction(String name, Map arguments, Map additionalProperties) { + this.name = name; + this.arguments = arguments; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the name of the function the model called. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return These are the arguments that the function was called with. + */ + @JsonProperty("arguments") + public Map getArguments() { + return arguments; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallFunction && equalTo((ToolCallFunction) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ToolCallFunction other) { + return name.equals(other.name) && arguments.equals(other.arguments); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.arguments); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + + Builder from(ToolCallFunction other); + } + + public interface _FinalStage { + ToolCallFunction build(); + + _FinalStage arguments(Map arguments); + + _FinalStage putAllArguments(Map arguments); + + _FinalStage arguments(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, _FinalStage { + private String name; + + private Map arguments = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ToolCallFunction other) { + name(other.getName()); + arguments(other.getArguments()); + return this; + } + + /** + *

This is the name of the function the model called.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

These are the arguments that the function was called with.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage arguments(String key, Object value) { + this.arguments.put(key, value); + return this; + } + + /** + *

These are the arguments that the function was called with.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllArguments(Map arguments) { + this.arguments.putAll(arguments); + return this; + } + + @java.lang.Override + @JsonSetter(value = "arguments", nulls = Nulls.SKIP) + public _FinalStage arguments(Map arguments) { + this.arguments.clear(); + this.arguments.putAll(arguments); + return this; + } + + @java.lang.Override + public ToolCallFunction build() { + return new ToolCallFunction(name, arguments, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ToolCallMessage.java b/src/main/java/com/vapi/api/types/ToolCallMessage.java new file mode 100644 index 0000000..201ecb1 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolCallMessage.java @@ -0,0 +1,258 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ToolCallMessage.Builder.class) +public final class ToolCallMessage { + private final String role; + + private final List> toolCalls; + + private final String message; + + private final double time; + + private final double secondsFromStart; + + private final Map additionalProperties; + + private ToolCallMessage( + String role, + List> toolCalls, + String message, + double time, + double secondsFromStart, + Map additionalProperties) { + this.role = role; + this.toolCalls = toolCalls; + this.message = message; + this.time = time; + this.secondsFromStart = secondsFromStart; + this.additionalProperties = additionalProperties; + } + + /** + * @return The role of the tool call in the conversation. + */ + @JsonProperty("role") + public String getRole() { + return role; + } + + /** + * @return The list of tool calls made during the conversation. + */ + @JsonProperty("toolCalls") + public List> getToolCalls() { + return toolCalls; + } + + /** + * @return The message content for the tool call. + */ + @JsonProperty("message") + public String getMessage() { + return message; + } + + /** + * @return The timestamp when the message was sent. + */ + @JsonProperty("time") + public double getTime() { + return time; + } + + /** + * @return The number of seconds from the start of the conversation. + */ + @JsonProperty("secondsFromStart") + public double getSecondsFromStart() { + return secondsFromStart; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallMessage && equalTo((ToolCallMessage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ToolCallMessage other) { + return role.equals(other.role) + && toolCalls.equals(other.toolCalls) + && message.equals(other.message) + && time == other.time + && secondsFromStart == other.secondsFromStart; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.role, this.toolCalls, this.message, this.time, this.secondsFromStart); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RoleStage builder() { + return new Builder(); + } + + public interface RoleStage { + MessageStage role(@NotNull String role); + + Builder from(ToolCallMessage other); + } + + public interface MessageStage { + TimeStage message(@NotNull String message); + } + + public interface TimeStage { + SecondsFromStartStage time(double time); + } + + public interface SecondsFromStartStage { + _FinalStage secondsFromStart(double secondsFromStart); + } + + public interface _FinalStage { + ToolCallMessage build(); + + _FinalStage toolCalls(List> toolCalls); + + _FinalStage addToolCalls(Map toolCalls); + + _FinalStage addAllToolCalls(List> toolCalls); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements RoleStage, MessageStage, TimeStage, SecondsFromStartStage, _FinalStage { + private String role; + + private String message; + + private double time; + + private double secondsFromStart; + + private List> toolCalls = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ToolCallMessage other) { + role(other.getRole()); + toolCalls(other.getToolCalls()); + message(other.getMessage()); + time(other.getTime()); + secondsFromStart(other.getSecondsFromStart()); + return this; + } + + /** + *

The role of the tool call in the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("role") + public MessageStage role(@NotNull String role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + /** + *

The message content for the tool call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message") + public TimeStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + /** + *

The timestamp when the message was sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("time") + public SecondsFromStartStage time(double time) { + this.time = time; + return this; + } + + /** + *

The number of seconds from the start of the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("secondsFromStart") + public _FinalStage secondsFromStart(double secondsFromStart) { + this.secondsFromStart = secondsFromStart; + return this; + } + + /** + *

The list of tool calls made during the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllToolCalls(List> toolCalls) { + this.toolCalls.addAll(toolCalls); + return this; + } + + /** + *

The list of tool calls made during the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addToolCalls(Map toolCalls) { + this.toolCalls.add(toolCalls); + return this; + } + + @java.lang.Override + @JsonSetter(value = "toolCalls", nulls = Nulls.SKIP) + public _FinalStage toolCalls(List> toolCalls) { + this.toolCalls.clear(); + this.toolCalls.addAll(toolCalls); + return this; + } + + @java.lang.Override + public ToolCallMessage build() { + return new ToolCallMessage(role, toolCalls, message, time, secondsFromStart, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ToolCallResult.java b/src/main/java/com/vapi/api/types/ToolCallResult.java new file mode 100644 index 0000000..0425f31 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolCallResult.java @@ -0,0 +1,290 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ToolCallResult.Builder.class) +public final class ToolCallResult { + private final Optional> message; + + private final String name; + + private final String toolCallId; + + private final Optional result; + + private final Optional error; + + private final Map additionalProperties; + + private ToolCallResult( + Optional> message, + String name, + String toolCallId, + Optional result, + Optional error, + Map additionalProperties) { + this.message = message; + this.name = name; + this.toolCallId = toolCallId; + this.result = result; + this.error = error; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the message that will be spoken to the user. + *

If this is not returned, assistant will speak:

+ *
    + *
  1. a request-complete or request-failed message from tool.messages, if it exists
  2. + *
  3. a response generated by the model, if not
  4. + *
+ */ + @JsonProperty("message") + public Optional> getMessage() { + return message; + } + + /** + * @return This is the name of the function the model called. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return This is the unique identifier for the tool call. + */ + @JsonProperty("toolCallId") + public String getToolCallId() { + return toolCallId; + } + + /** + * @return This is the result if the tool call was successful. This is added to the conversation history. + *

Further, if this is returned, assistant will speak:

+ *
    + *
  1. the message, if it exists and is of type request-complete
  2. + *
  3. a request-complete message from tool.messages, if it exists
  4. + *
  5. a response generated by the model, if neither exist
  6. + *
+ */ + @JsonProperty("result") + public Optional getResult() { + return result; + } + + /** + * @return This is the error if the tool call was not successful. This is added to the conversation history. + *

Further, if this is returned, assistant will speak:

+ *
    + *
  1. the message, if it exists and is of type request-failed
  2. + *
  3. a request-failed message from tool.messages, if it exists
  4. + *
  5. a response generated by the model, if neither exist
  6. + *
+ */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallResult && equalTo((ToolCallResult) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ToolCallResult other) { + return message.equals(other.message) + && name.equals(other.name) + && toolCallId.equals(other.toolCallId) + && result.equals(other.result) + && error.equals(other.error); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.message, this.name, this.toolCallId, this.result, this.error); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + ToolCallIdStage name(@NotNull String name); + + Builder from(ToolCallResult other); + } + + public interface ToolCallIdStage { + _FinalStage toolCallId(@NotNull String toolCallId); + } + + public interface _FinalStage { + ToolCallResult build(); + + _FinalStage message(Optional> message); + + _FinalStage message(List message); + + _FinalStage result(Optional result); + + _FinalStage result(String result); + + _FinalStage error(Optional error); + + _FinalStage error(String error); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, ToolCallIdStage, _FinalStage { + private String name; + + private String toolCallId; + + private Optional error = Optional.empty(); + + private Optional result = Optional.empty(); + + private Optional> message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ToolCallResult other) { + message(other.getMessage()); + name(other.getName()); + toolCallId(other.getToolCallId()); + result(other.getResult()); + error(other.getError()); + return this; + } + + /** + *

This is the name of the function the model called.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public ToolCallIdStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

This is the unique identifier for the tool call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("toolCallId") + public _FinalStage toolCallId(@NotNull String toolCallId) { + this.toolCallId = Objects.requireNonNull(toolCallId, "toolCallId must not be null"); + return this; + } + + /** + *

This is the error if the tool call was not successful. This is added to the conversation history.

+ *

Further, if this is returned, assistant will speak:

+ *
    + *
  1. the message, if it exists and is of type request-failed
  2. + *
  3. a request-failed message from tool.messages, if it exists
  4. + *
  5. a response generated by the model, if neither exist
  6. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + @java.lang.Override + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public _FinalStage error(Optional error) { + this.error = error; + return this; + } + + /** + *

This is the result if the tool call was successful. This is added to the conversation history.

+ *

Further, if this is returned, assistant will speak:

+ *
    + *
  1. the message, if it exists and is of type request-complete
  2. + *
  3. a request-complete message from tool.messages, if it exists
  4. + *
  5. a response generated by the model, if neither exist
  6. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage result(String result) { + this.result = Optional.ofNullable(result); + return this; + } + + @java.lang.Override + @JsonSetter(value = "result", nulls = Nulls.SKIP) + public _FinalStage result(Optional result) { + this.result = result; + return this; + } + + /** + *

This is the message that will be spoken to the user.

+ *

If this is not returned, assistant will speak:

+ *
    + *
  1. a request-complete or request-failed message from tool.messages, if it exists
  2. + *
  3. a response generated by the model, if not
  4. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage message(List message) { + this.message = Optional.ofNullable(message); + return this; + } + + @java.lang.Override + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public _FinalStage message(Optional> message) { + this.message = message; + return this; + } + + @java.lang.Override + public ToolCallResult build() { + return new ToolCallResult(message, name, toolCallId, result, error, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ToolCallResultMessage.java b/src/main/java/com/vapi/api/types/ToolCallResultMessage.java new file mode 100644 index 0000000..f6f889d --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolCallResultMessage.java @@ -0,0 +1,274 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ToolCallResultMessage.Builder.class) +public final class ToolCallResultMessage { + private final String role; + + private final String toolCallId; + + private final String name; + + private final String result; + + private final double time; + + private final double secondsFromStart; + + private final Map additionalProperties; + + private ToolCallResultMessage( + String role, + String toolCallId, + String name, + String result, + double time, + double secondsFromStart, + Map additionalProperties) { + this.role = role; + this.toolCallId = toolCallId; + this.name = name; + this.result = result; + this.time = time; + this.secondsFromStart = secondsFromStart; + this.additionalProperties = additionalProperties; + } + + /** + * @return The role of the tool call result in the conversation. + */ + @JsonProperty("role") + public String getRole() { + return role; + } + + /** + * @return The ID of the tool call. + */ + @JsonProperty("toolCallId") + public String getToolCallId() { + return toolCallId; + } + + /** + * @return The name of the tool that returned the result. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The result of the tool call in JSON format. + */ + @JsonProperty("result") + public String getResult() { + return result; + } + + /** + * @return The timestamp when the message was sent. + */ + @JsonProperty("time") + public double getTime() { + return time; + } + + /** + * @return The number of seconds from the start of the conversation. + */ + @JsonProperty("secondsFromStart") + public double getSecondsFromStart() { + return secondsFromStart; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolCallResultMessage && equalTo((ToolCallResultMessage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ToolCallResultMessage other) { + return role.equals(other.role) + && toolCallId.equals(other.toolCallId) + && name.equals(other.name) + && result.equals(other.result) + && time == other.time + && secondsFromStart == other.secondsFromStart; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.role, this.toolCallId, this.name, this.result, this.time, this.secondsFromStart); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RoleStage builder() { + return new Builder(); + } + + public interface RoleStage { + ToolCallIdStage role(@NotNull String role); + + Builder from(ToolCallResultMessage other); + } + + public interface ToolCallIdStage { + NameStage toolCallId(@NotNull String toolCallId); + } + + public interface NameStage { + ResultStage name(@NotNull String name); + } + + public interface ResultStage { + TimeStage result(@NotNull String result); + } + + public interface TimeStage { + SecondsFromStartStage time(double time); + } + + public interface SecondsFromStartStage { + _FinalStage secondsFromStart(double secondsFromStart); + } + + public interface _FinalStage { + ToolCallResultMessage build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements RoleStage, + ToolCallIdStage, + NameStage, + ResultStage, + TimeStage, + SecondsFromStartStage, + _FinalStage { + private String role; + + private String toolCallId; + + private String name; + + private String result; + + private double time; + + private double secondsFromStart; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ToolCallResultMessage other) { + role(other.getRole()); + toolCallId(other.getToolCallId()); + name(other.getName()); + result(other.getResult()); + time(other.getTime()); + secondsFromStart(other.getSecondsFromStart()); + return this; + } + + /** + *

The role of the tool call result in the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("role") + public ToolCallIdStage role(@NotNull String role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + /** + *

The ID of the tool call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("toolCallId") + public NameStage toolCallId(@NotNull String toolCallId) { + this.toolCallId = Objects.requireNonNull(toolCallId, "toolCallId must not be null"); + return this; + } + + /** + *

The name of the tool that returned the result.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public ResultStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

The result of the tool call in JSON format.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("result") + public TimeStage result(@NotNull String result) { + this.result = Objects.requireNonNull(result, "result must not be null"); + return this; + } + + /** + *

The timestamp when the message was sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("time") + public SecondsFromStartStage time(double time) { + this.time = time; + return this; + } + + /** + *

The number of seconds from the start of the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("secondsFromStart") + public _FinalStage secondsFromStart(double secondsFromStart) { + this.secondsFromStart = secondsFromStart; + return this; + } + + @java.lang.Override + public ToolCallResultMessage build() { + return new ToolCallResultMessage( + role, toolCallId, name, result, time, secondsFromStart, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ToolCallResultMessageItem.java b/src/main/java/com/vapi/api/types/ToolCallResultMessageItem.java new file mode 100644 index 0000000..19c007c --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolCallResultMessageItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class ToolCallResultMessageItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private ToolCallResultMessageItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static ToolCallResultMessageItem requestComplete(ToolMessageComplete value) { + return new ToolCallResultMessageItem(new RequestCompleteValue(value)); + } + + public static ToolCallResultMessageItem requestFailed(ToolMessageFailed value) { + return new ToolCallResultMessageItem(new RequestFailedValue(value)); + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(RequestCompleteValue.class), @JsonSubTypes.Type(RequestFailedValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolCallResultMessageItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "ToolCallResultMessageItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "ToolCallResultMessageItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/ToolMessageComplete.java b/src/main/java/com/vapi/api/types/ToolMessageComplete.java new file mode 100644 index 0000000..005d010 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolMessageComplete.java @@ -0,0 +1,257 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ToolMessageComplete.Builder.class) +public final class ToolMessageComplete { + private final Optional role; + + private final Optional endCallAfterSpokenEnabled; + + private final String content; + + private final Optional> conditions; + + private final Map additionalProperties; + + private ToolMessageComplete( + Optional role, + Optional endCallAfterSpokenEnabled, + String content, + Optional> conditions, + Map additionalProperties) { + this.role = role; + this.endCallAfterSpokenEnabled = endCallAfterSpokenEnabled; + this.content = content; + this.conditions = conditions; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is optional and defaults to "assistant". + *

When role=assistant, content is said out loud.

+ *

When role=system, content is passed to the model in a system message. Example: + * system: default one + * assistant: + * user: + * assistant: + * user: + * assistant: + * user: + * assistant: tool called + * tool: your server response + * <--- system prompt as hint + * ---> model generates response which is spoken + * This is useful when you want to provide a hint to the model about what to say next.

+ */ + @JsonProperty("role") + public Optional getRole() { + return role; + } + + /** + * @return This is an optional boolean that if true, the call will end after the message is spoken. Default is false. + *

This is ignored if role is set to system.

+ *

@default false

+ */ + @JsonProperty("endCallAfterSpokenEnabled") + public Optional getEndCallAfterSpokenEnabled() { + return endCallAfterSpokenEnabled; + } + + /** + * @return This is the content that the assistant says when this message is triggered. + */ + @JsonProperty("content") + public String getContent() { + return content; + } + + /** + * @return This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered. + */ + @JsonProperty("conditions") + public Optional> getConditions() { + return conditions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolMessageComplete && equalTo((ToolMessageComplete) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ToolMessageComplete other) { + return role.equals(other.role) + && endCallAfterSpokenEnabled.equals(other.endCallAfterSpokenEnabled) + && content.equals(other.content) + && conditions.equals(other.conditions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.role, this.endCallAfterSpokenEnabled, this.content, this.conditions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ContentStage builder() { + return new Builder(); + } + + public interface ContentStage { + _FinalStage content(@NotNull String content); + + Builder from(ToolMessageComplete other); + } + + public interface _FinalStage { + ToolMessageComplete build(); + + _FinalStage role(Optional role); + + _FinalStage role(ToolMessageCompleteRole role); + + _FinalStage endCallAfterSpokenEnabled(Optional endCallAfterSpokenEnabled); + + _FinalStage endCallAfterSpokenEnabled(Boolean endCallAfterSpokenEnabled); + + _FinalStage conditions(Optional> conditions); + + _FinalStage conditions(List conditions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ContentStage, _FinalStage { + private String content; + + private Optional> conditions = Optional.empty(); + + private Optional endCallAfterSpokenEnabled = Optional.empty(); + + private Optional role = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ToolMessageComplete other) { + role(other.getRole()); + endCallAfterSpokenEnabled(other.getEndCallAfterSpokenEnabled()); + content(other.getContent()); + conditions(other.getConditions()); + return this; + } + + /** + *

This is the content that the assistant says when this message is triggered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("content") + public _FinalStage content(@NotNull String content) { + this.content = Objects.requireNonNull(content, "content must not be null"); + return this; + } + + /** + *

This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage conditions(List conditions) { + this.conditions = Optional.ofNullable(conditions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "conditions", nulls = Nulls.SKIP) + public _FinalStage conditions(Optional> conditions) { + this.conditions = conditions; + return this; + } + + /** + *

This is an optional boolean that if true, the call will end after the message is spoken. Default is false.

+ *

This is ignored if role is set to system.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endCallAfterSpokenEnabled(Boolean endCallAfterSpokenEnabled) { + this.endCallAfterSpokenEnabled = Optional.ofNullable(endCallAfterSpokenEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "endCallAfterSpokenEnabled", nulls = Nulls.SKIP) + public _FinalStage endCallAfterSpokenEnabled(Optional endCallAfterSpokenEnabled) { + this.endCallAfterSpokenEnabled = endCallAfterSpokenEnabled; + return this; + } + + /** + *

This is optional and defaults to "assistant".

+ *

When role=assistant, content is said out loud.

+ *

When role=system, content is passed to the model in a system message. Example: + * system: default one + * assistant: + * user: + * assistant: + * user: + * assistant: + * user: + * assistant: tool called + * tool: your server response + * <--- system prompt as hint + * ---> model generates response which is spoken + * This is useful when you want to provide a hint to the model about what to say next.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage role(ToolMessageCompleteRole role) { + this.role = Optional.ofNullable(role); + return this; + } + + @java.lang.Override + @JsonSetter(value = "role", nulls = Nulls.SKIP) + public _FinalStage role(Optional role) { + this.role = role; + return this; + } + + @java.lang.Override + public ToolMessageComplete build() { + return new ToolMessageComplete(role, endCallAfterSpokenEnabled, content, conditions, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ToolMessageCompleteRole.java b/src/main/java/com/vapi/api/types/ToolMessageCompleteRole.java new file mode 100644 index 0000000..060ab7a --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolMessageCompleteRole.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ToolMessageCompleteRole { + ASSISTANT("assistant"), + + SYSTEM("system"); + + private final String value; + + ToolMessageCompleteRole(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/ToolMessageDelayed.java b/src/main/java/com/vapi/api/types/ToolMessageDelayed.java new file mode 100644 index 0000000..0b5ce5f --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolMessageDelayed.java @@ -0,0 +1,188 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ToolMessageDelayed.Builder.class) +public final class ToolMessageDelayed { + private final Optional timingMilliseconds; + + private final String content; + + private final Optional> conditions; + + private final Map additionalProperties; + + private ToolMessageDelayed( + Optional timingMilliseconds, + String content, + Optional> conditions, + Map additionalProperties) { + this.timingMilliseconds = timingMilliseconds; + this.content = content; + this.conditions = conditions; + this.additionalProperties = additionalProperties; + } + + /** + * @return The number of milliseconds to wait for the server response before saying this message. + */ + @JsonProperty("timingMilliseconds") + public Optional getTimingMilliseconds() { + return timingMilliseconds; + } + + /** + * @return This is the content that the assistant says when this message is triggered. + */ + @JsonProperty("content") + public String getContent() { + return content; + } + + /** + * @return This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered. + */ + @JsonProperty("conditions") + public Optional> getConditions() { + return conditions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolMessageDelayed && equalTo((ToolMessageDelayed) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ToolMessageDelayed other) { + return timingMilliseconds.equals(other.timingMilliseconds) + && content.equals(other.content) + && conditions.equals(other.conditions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.timingMilliseconds, this.content, this.conditions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ContentStage builder() { + return new Builder(); + } + + public interface ContentStage { + _FinalStage content(@NotNull String content); + + Builder from(ToolMessageDelayed other); + } + + public interface _FinalStage { + ToolMessageDelayed build(); + + _FinalStage timingMilliseconds(Optional timingMilliseconds); + + _FinalStage timingMilliseconds(Double timingMilliseconds); + + _FinalStage conditions(Optional> conditions); + + _FinalStage conditions(List conditions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ContentStage, _FinalStage { + private String content; + + private Optional> conditions = Optional.empty(); + + private Optional timingMilliseconds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ToolMessageDelayed other) { + timingMilliseconds(other.getTimingMilliseconds()); + content(other.getContent()); + conditions(other.getConditions()); + return this; + } + + /** + *

This is the content that the assistant says when this message is triggered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("content") + public _FinalStage content(@NotNull String content) { + this.content = Objects.requireNonNull(content, "content must not be null"); + return this; + } + + /** + *

This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage conditions(List conditions) { + this.conditions = Optional.ofNullable(conditions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "conditions", nulls = Nulls.SKIP) + public _FinalStage conditions(Optional> conditions) { + this.conditions = conditions; + return this; + } + + /** + *

The number of milliseconds to wait for the server response before saying this message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage timingMilliseconds(Double timingMilliseconds) { + this.timingMilliseconds = Optional.ofNullable(timingMilliseconds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "timingMilliseconds", nulls = Nulls.SKIP) + public _FinalStage timingMilliseconds(Optional timingMilliseconds) { + this.timingMilliseconds = timingMilliseconds; + return this; + } + + @java.lang.Override + public ToolMessageDelayed build() { + return new ToolMessageDelayed(timingMilliseconds, content, conditions, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ToolMessageFailed.java b/src/main/java/com/vapi/api/types/ToolMessageFailed.java new file mode 100644 index 0000000..6dc7af2 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolMessageFailed.java @@ -0,0 +1,190 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ToolMessageFailed.Builder.class) +public final class ToolMessageFailed { + private final Optional endCallAfterSpokenEnabled; + + private final String content; + + private final Optional> conditions; + + private final Map additionalProperties; + + private ToolMessageFailed( + Optional endCallAfterSpokenEnabled, + String content, + Optional> conditions, + Map additionalProperties) { + this.endCallAfterSpokenEnabled = endCallAfterSpokenEnabled; + this.content = content; + this.conditions = conditions; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is an optional boolean that if true, the call will end after the message is spoken. Default is false. + *

@default false

+ */ + @JsonProperty("endCallAfterSpokenEnabled") + public Optional getEndCallAfterSpokenEnabled() { + return endCallAfterSpokenEnabled; + } + + /** + * @return This is the content that the assistant says when this message is triggered. + */ + @JsonProperty("content") + public String getContent() { + return content; + } + + /** + * @return This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered. + */ + @JsonProperty("conditions") + public Optional> getConditions() { + return conditions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolMessageFailed && equalTo((ToolMessageFailed) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ToolMessageFailed other) { + return endCallAfterSpokenEnabled.equals(other.endCallAfterSpokenEnabled) + && content.equals(other.content) + && conditions.equals(other.conditions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.endCallAfterSpokenEnabled, this.content, this.conditions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ContentStage builder() { + return new Builder(); + } + + public interface ContentStage { + _FinalStage content(@NotNull String content); + + Builder from(ToolMessageFailed other); + } + + public interface _FinalStage { + ToolMessageFailed build(); + + _FinalStage endCallAfterSpokenEnabled(Optional endCallAfterSpokenEnabled); + + _FinalStage endCallAfterSpokenEnabled(Boolean endCallAfterSpokenEnabled); + + _FinalStage conditions(Optional> conditions); + + _FinalStage conditions(List conditions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ContentStage, _FinalStage { + private String content; + + private Optional> conditions = Optional.empty(); + + private Optional endCallAfterSpokenEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ToolMessageFailed other) { + endCallAfterSpokenEnabled(other.getEndCallAfterSpokenEnabled()); + content(other.getContent()); + conditions(other.getConditions()); + return this; + } + + /** + *

This is the content that the assistant says when this message is triggered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("content") + public _FinalStage content(@NotNull String content) { + this.content = Objects.requireNonNull(content, "content must not be null"); + return this; + } + + /** + *

This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage conditions(List conditions) { + this.conditions = Optional.ofNullable(conditions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "conditions", nulls = Nulls.SKIP) + public _FinalStage conditions(Optional> conditions) { + this.conditions = conditions; + return this; + } + + /** + *

This is an optional boolean that if true, the call will end after the message is spoken. Default is false.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage endCallAfterSpokenEnabled(Boolean endCallAfterSpokenEnabled) { + this.endCallAfterSpokenEnabled = Optional.ofNullable(endCallAfterSpokenEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "endCallAfterSpokenEnabled", nulls = Nulls.SKIP) + public _FinalStage endCallAfterSpokenEnabled(Optional endCallAfterSpokenEnabled) { + this.endCallAfterSpokenEnabled = endCallAfterSpokenEnabled; + return this; + } + + @java.lang.Override + public ToolMessageFailed build() { + return new ToolMessageFailed(endCallAfterSpokenEnabled, content, conditions, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ToolMessageStart.java b/src/main/java/com/vapi/api/types/ToolMessageStart.java new file mode 100644 index 0000000..64e82b7 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolMessageStart.java @@ -0,0 +1,148 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ToolMessageStart.Builder.class) +public final class ToolMessageStart { + private final String content; + + private final Optional> conditions; + + private final Map additionalProperties; + + private ToolMessageStart( + String content, Optional> conditions, Map additionalProperties) { + this.content = content; + this.conditions = conditions; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the content that the assistant says when this message is triggered. + */ + @JsonProperty("content") + public String getContent() { + return content; + } + + /** + * @return This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered. + */ + @JsonProperty("conditions") + public Optional> getConditions() { + return conditions; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolMessageStart && equalTo((ToolMessageStart) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ToolMessageStart other) { + return content.equals(other.content) && conditions.equals(other.conditions); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.content, this.conditions); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ContentStage builder() { + return new Builder(); + } + + public interface ContentStage { + _FinalStage content(@NotNull String content); + + Builder from(ToolMessageStart other); + } + + public interface _FinalStage { + ToolMessageStart build(); + + _FinalStage conditions(Optional> conditions); + + _FinalStage conditions(List conditions); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ContentStage, _FinalStage { + private String content; + + private Optional> conditions = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ToolMessageStart other) { + content(other.getContent()); + conditions(other.getConditions()); + return this; + } + + /** + *

This is the content that the assistant says when this message is triggered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("content") + public _FinalStage content(@NotNull String content) { + this.content = Objects.requireNonNull(content, "content must not be null"); + return this; + } + + /** + *

This is an optional array of conditions that the tool call arguments must meet in order for this message to be triggered.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage conditions(List conditions) { + this.conditions = Optional.ofNullable(conditions); + return this; + } + + @java.lang.Override + @JsonSetter(value = "conditions", nulls = Nulls.SKIP) + public _FinalStage conditions(Optional> conditions) { + this.conditions = conditions; + return this; + } + + @java.lang.Override + public ToolMessageStart build() { + return new ToolMessageStart(content, conditions, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ToolTemplateMetadata.java b/src/main/java/com/vapi/api/types/ToolTemplateMetadata.java new file mode 100644 index 0000000..6d97a6a --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolTemplateMetadata.java @@ -0,0 +1,145 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ToolTemplateMetadata.Builder.class) +public final class ToolTemplateMetadata { + private final Optional collectionType; + + private final Optional collectionId; + + private final Optional collectionName; + + private final Map additionalProperties; + + private ToolTemplateMetadata( + Optional collectionType, + Optional collectionId, + Optional collectionName, + Map additionalProperties) { + this.collectionType = collectionType; + this.collectionId = collectionId; + this.collectionName = collectionName; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("collectionType") + public Optional getCollectionType() { + return collectionType; + } + + @JsonProperty("collectionId") + public Optional getCollectionId() { + return collectionId; + } + + @JsonProperty("collectionName") + public Optional getCollectionName() { + return collectionName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolTemplateMetadata && equalTo((ToolTemplateMetadata) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ToolTemplateMetadata other) { + return collectionType.equals(other.collectionType) + && collectionId.equals(other.collectionId) + && collectionName.equals(other.collectionName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.collectionType, this.collectionId, this.collectionName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional collectionType = Optional.empty(); + + private Optional collectionId = Optional.empty(); + + private Optional collectionName = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ToolTemplateMetadata other) { + collectionType(other.getCollectionType()); + collectionId(other.getCollectionId()); + collectionName(other.getCollectionName()); + return this; + } + + @JsonSetter(value = "collectionType", nulls = Nulls.SKIP) + public Builder collectionType(Optional collectionType) { + this.collectionType = collectionType; + return this; + } + + public Builder collectionType(String collectionType) { + this.collectionType = Optional.ofNullable(collectionType); + return this; + } + + @JsonSetter(value = "collectionId", nulls = Nulls.SKIP) + public Builder collectionId(Optional collectionId) { + this.collectionId = collectionId; + return this; + } + + public Builder collectionId(String collectionId) { + this.collectionId = Optional.ofNullable(collectionId); + return this; + } + + @JsonSetter(value = "collectionName", nulls = Nulls.SKIP) + public Builder collectionName(Optional collectionName) { + this.collectionName = collectionName; + return this; + } + + public Builder collectionName(String collectionName) { + this.collectionName = Optional.ofNullable(collectionName); + return this; + } + + public ToolTemplateMetadata build() { + return new ToolTemplateMetadata(collectionType, collectionId, collectionName, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/ToolTemplateSetup.java b/src/main/java/com/vapi/api/types/ToolTemplateSetup.java new file mode 100644 index 0000000..af96b90 --- /dev/null +++ b/src/main/java/com/vapi/api/types/ToolTemplateSetup.java @@ -0,0 +1,196 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ToolTemplateSetup.Builder.class) +public final class ToolTemplateSetup { + private final String title; + + private final Optional description; + + private final Optional videoUrl; + + private final Optional docsUrl; + + private final Map additionalProperties; + + private ToolTemplateSetup( + String title, + Optional description, + Optional videoUrl, + Optional docsUrl, + Map additionalProperties) { + this.title = title; + this.description = description; + this.videoUrl = videoUrl; + this.docsUrl = docsUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("title") + public String getTitle() { + return title; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("videoUrl") + public Optional getVideoUrl() { + return videoUrl; + } + + @JsonProperty("docsUrl") + public Optional getDocsUrl() { + return docsUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ToolTemplateSetup && equalTo((ToolTemplateSetup) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ToolTemplateSetup other) { + return title.equals(other.title) + && description.equals(other.description) + && videoUrl.equals(other.videoUrl) + && docsUrl.equals(other.docsUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.title, this.description, this.videoUrl, this.docsUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TitleStage builder() { + return new Builder(); + } + + public interface TitleStage { + _FinalStage title(@NotNull String title); + + Builder from(ToolTemplateSetup other); + } + + public interface _FinalStage { + ToolTemplateSetup build(); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage videoUrl(Optional videoUrl); + + _FinalStage videoUrl(String videoUrl); + + _FinalStage docsUrl(Optional docsUrl); + + _FinalStage docsUrl(String docsUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TitleStage, _FinalStage { + private String title; + + private Optional docsUrl = Optional.empty(); + + private Optional videoUrl = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ToolTemplateSetup other) { + title(other.getTitle()); + description(other.getDescription()); + videoUrl(other.getVideoUrl()); + docsUrl(other.getDocsUrl()); + return this; + } + + @java.lang.Override + @JsonSetter("title") + public _FinalStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage docsUrl(String docsUrl) { + this.docsUrl = Optional.ofNullable(docsUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "docsUrl", nulls = Nulls.SKIP) + public _FinalStage docsUrl(Optional docsUrl) { + this.docsUrl = docsUrl; + return this; + } + + @java.lang.Override + public _FinalStage videoUrl(String videoUrl) { + this.videoUrl = Optional.ofNullable(videoUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "videoUrl", nulls = Nulls.SKIP) + public _FinalStage videoUrl(Optional videoUrl) { + this.videoUrl = videoUrl; + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public ToolTemplateSetup build() { + return new ToolTemplateSetup(title, description, videoUrl, docsUrl, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TranscriberCost.java b/src/main/java/com/vapi/api/types/TranscriberCost.java new file mode 100644 index 0000000..9a9b025 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TranscriberCost.java @@ -0,0 +1,215 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TranscriberCost.Builder.class) +public final class TranscriberCost { + private final Map transcriber; + + private final double minutes; + + private final double cost; + + private final Map additionalProperties; + + private TranscriberCost( + Map transcriber, double minutes, double cost, Map additionalProperties) { + this.transcriber = transcriber; + this.minutes = minutes; + this.cost = cost; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the transcriber that was used during the call. + *

This matches one of the below:

+ *
    + *
  • call.assistant.transcriber,
  • + *
  • call.assistantId->transcriber,
  • + *
  • call.squad[n].assistant.transcriber,
  • + *
  • call.squad[n].assistantId->transcriber,
  • + *
  • call.squadId->[n].assistant.transcriber,
  • + *
  • call.squadId->[n].assistantId->transcriber.
  • + *
+ */ + @JsonProperty("transcriber") + public Map getTranscriber() { + return transcriber; + } + + /** + * @return This is the minutes of transcriber usage. This should match call.endedAt - call.startedAt for single assistant calls, while squad calls will have multiple transcriber costs one for each assistant that was used. + */ + @JsonProperty("minutes") + public double getMinutes() { + return minutes; + } + + /** + * @return This is the cost of the component in USD. + */ + @JsonProperty("cost") + public double getCost() { + return cost; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TranscriberCost && equalTo((TranscriberCost) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TranscriberCost other) { + return transcriber.equals(other.transcriber) && minutes == other.minutes && cost == other.cost; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.transcriber, this.minutes, this.cost); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MinutesStage builder() { + return new Builder(); + } + + public interface MinutesStage { + CostStage minutes(double minutes); + + Builder from(TranscriberCost other); + } + + public interface CostStage { + _FinalStage cost(double cost); + } + + public interface _FinalStage { + TranscriberCost build(); + + _FinalStage transcriber(Map transcriber); + + _FinalStage putAllTranscriber(Map transcriber); + + _FinalStage transcriber(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MinutesStage, CostStage, _FinalStage { + private double minutes; + + private double cost; + + private Map transcriber = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TranscriberCost other) { + transcriber(other.getTranscriber()); + minutes(other.getMinutes()); + cost(other.getCost()); + return this; + } + + /** + *

This is the minutes of transcriber usage. This should match call.endedAt - call.startedAt for single assistant calls, while squad calls will have multiple transcriber costs one for each assistant that was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("minutes") + public CostStage minutes(double minutes) { + this.minutes = minutes; + return this; + } + + /** + *

This is the cost of the component in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cost") + public _FinalStage cost(double cost) { + this.cost = cost; + return this; + } + + /** + *

This is the transcriber that was used during the call.

+ *

This matches one of the below:

+ *
    + *
  • call.assistant.transcriber,
  • + *
  • call.assistantId->transcriber,
  • + *
  • call.squad[n].assistant.transcriber,
  • + *
  • call.squad[n].assistantId->transcriber,
  • + *
  • call.squadId->[n].assistant.transcriber,
  • + *
  • call.squadId->[n].assistantId->transcriber.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage transcriber(String key, Object value) { + this.transcriber.put(key, value); + return this; + } + + /** + *

This is the transcriber that was used during the call.

+ *

This matches one of the below:

+ *
    + *
  • call.assistant.transcriber,
  • + *
  • call.assistantId->transcriber,
  • + *
  • call.squad[n].assistant.transcriber,
  • + *
  • call.squad[n].assistantId->transcriber,
  • + *
  • call.squadId->[n].assistant.transcriber,
  • + *
  • call.squadId->[n].assistantId->transcriber.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllTranscriber(Map transcriber) { + this.transcriber.putAll(transcriber); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transcriber", nulls = Nulls.SKIP) + public _FinalStage transcriber(Map transcriber) { + this.transcriber.clear(); + this.transcriber.putAll(transcriber); + return this; + } + + @java.lang.Override + public TranscriberCost build() { + return new TranscriberCost(transcriber, minutes, cost, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TranscriptPlan.java b/src/main/java/com/vapi/api/types/TranscriptPlan.java new file mode 100644 index 0000000..e003dac --- /dev/null +++ b/src/main/java/com/vapi/api/types/TranscriptPlan.java @@ -0,0 +1,175 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TranscriptPlan.Builder.class) +public final class TranscriptPlan { + private final Optional enabled; + + private final Optional assistantName; + + private final Optional userName; + + private final Map additionalProperties; + + private TranscriptPlan( + Optional enabled, + Optional assistantName, + Optional userName, + Map additionalProperties) { + this.enabled = enabled; + this.assistantName = assistantName; + this.userName = userName; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines whether the transcript is stored in call.artifact.transcript. Defaults to true. + *

@default true

+ */ + @JsonProperty("enabled") + public Optional getEnabled() { + return enabled; + } + + /** + * @return This is the name of the assistant in the transcript. Defaults to 'AI'. + *

Usage:

+ *
    + *
  • If you want to change the name of the assistant in the transcript, set this. Example, here is what the transcript would look like with assistantName set to 'Buyer':
  • + *
+ *
User: Hello, how are you?
+     * Buyer: I'm fine.
+     * User: Do you want to buy a car?
+     * Buyer: No.
+     * 
+ *

@default 'AI'

+ */ + @JsonProperty("assistantName") + public Optional getAssistantName() { + return assistantName; + } + + /** + * @return This is the name of the user in the transcript. Defaults to 'User'. + *

Usage:

+ *
    + *
  • If you want to change the name of the user in the transcript, set this. Example, here is what the transcript would look like with userName set to 'Seller':
  • + *
+ *
Seller: Hello, how are you?
+     * AI: I'm fine.
+     * Seller: Do you want to buy a car?
+     * AI: No.
+     * 
+ *

@default 'User'

+ */ + @JsonProperty("userName") + public Optional getUserName() { + return userName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TranscriptPlan && equalTo((TranscriptPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TranscriptPlan other) { + return enabled.equals(other.enabled) + && assistantName.equals(other.assistantName) + && userName.equals(other.userName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.enabled, this.assistantName, this.userName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional enabled = Optional.empty(); + + private Optional assistantName = Optional.empty(); + + private Optional userName = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TranscriptPlan other) { + enabled(other.getEnabled()); + assistantName(other.getAssistantName()); + userName(other.getUserName()); + return this; + } + + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(Boolean enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + @JsonSetter(value = "assistantName", nulls = Nulls.SKIP) + public Builder assistantName(Optional assistantName) { + this.assistantName = assistantName; + return this; + } + + public Builder assistantName(String assistantName) { + this.assistantName = Optional.ofNullable(assistantName); + return this; + } + + @JsonSetter(value = "userName", nulls = Nulls.SKIP) + public Builder userName(Optional userName) { + this.userName = userName; + return this; + } + + public Builder userName(String userName) { + this.userName = Optional.ofNullable(userName); + return this; + } + + public TranscriptPlan build() { + return new TranscriptPlan(enabled, assistantName, userName, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TranscriptionEndpointingPlan.java b/src/main/java/com/vapi/api/types/TranscriptionEndpointingPlan.java new file mode 100644 index 0000000..83ea36e --- /dev/null +++ b/src/main/java/com/vapi/api/types/TranscriptionEndpointingPlan.java @@ -0,0 +1,161 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TranscriptionEndpointingPlan.Builder.class) +public final class TranscriptionEndpointingPlan { + private final Optional onPunctuationSeconds; + + private final Optional onNoPunctuationSeconds; + + private final Optional onNumberSeconds; + + private final Map additionalProperties; + + private TranscriptionEndpointingPlan( + Optional onPunctuationSeconds, + Optional onNoPunctuationSeconds, + Optional onNumberSeconds, + Map additionalProperties) { + this.onPunctuationSeconds = onPunctuationSeconds; + this.onNoPunctuationSeconds = onNoPunctuationSeconds; + this.onNumberSeconds = onNumberSeconds; + this.additionalProperties = additionalProperties; + } + + /** + * @return The minimum number of seconds to wait after transcription ending with punctuation before sending a request to the model. Defaults to 0.1. + *

This setting exists because the transcriber punctuates the transcription when it's more confident that customer has completed a thought.

+ *

@default 0.1

+ */ + @JsonProperty("onPunctuationSeconds") + public Optional getOnPunctuationSeconds() { + return onPunctuationSeconds; + } + + /** + * @return The minimum number of seconds to wait after transcription ending without punctuation before sending a request to the model. Defaults to 1.5. + *

This setting exists to catch the cases where the transcriber was not confident enough to punctuate the transcription, but the customer is done and has been silent for a long time.

+ *

@default 1.5

+ */ + @JsonProperty("onNoPunctuationSeconds") + public Optional getOnNoPunctuationSeconds() { + return onNoPunctuationSeconds; + } + + /** + * @return The minimum number of seconds to wait after transcription ending with a number before sending a request to the model. Defaults to 0.4. + *

This setting exists because the transcriber will sometimes punctuate the transcription ending with a number, even though the customer hasn't uttered the full number. This happens commonly for long numbers when the customer reads the number in chunks.

+ *

@default 0.5

+ */ + @JsonProperty("onNumberSeconds") + public Optional getOnNumberSeconds() { + return onNumberSeconds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TranscriptionEndpointingPlan && equalTo((TranscriptionEndpointingPlan) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TranscriptionEndpointingPlan other) { + return onPunctuationSeconds.equals(other.onPunctuationSeconds) + && onNoPunctuationSeconds.equals(other.onNoPunctuationSeconds) + && onNumberSeconds.equals(other.onNumberSeconds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.onPunctuationSeconds, this.onNoPunctuationSeconds, this.onNumberSeconds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional onPunctuationSeconds = Optional.empty(); + + private Optional onNoPunctuationSeconds = Optional.empty(); + + private Optional onNumberSeconds = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TranscriptionEndpointingPlan other) { + onPunctuationSeconds(other.getOnPunctuationSeconds()); + onNoPunctuationSeconds(other.getOnNoPunctuationSeconds()); + onNumberSeconds(other.getOnNumberSeconds()); + return this; + } + + @JsonSetter(value = "onPunctuationSeconds", nulls = Nulls.SKIP) + public Builder onPunctuationSeconds(Optional onPunctuationSeconds) { + this.onPunctuationSeconds = onPunctuationSeconds; + return this; + } + + public Builder onPunctuationSeconds(Double onPunctuationSeconds) { + this.onPunctuationSeconds = Optional.ofNullable(onPunctuationSeconds); + return this; + } + + @JsonSetter(value = "onNoPunctuationSeconds", nulls = Nulls.SKIP) + public Builder onNoPunctuationSeconds(Optional onNoPunctuationSeconds) { + this.onNoPunctuationSeconds = onNoPunctuationSeconds; + return this; + } + + public Builder onNoPunctuationSeconds(Double onNoPunctuationSeconds) { + this.onNoPunctuationSeconds = Optional.ofNullable(onNoPunctuationSeconds); + return this; + } + + @JsonSetter(value = "onNumberSeconds", nulls = Nulls.SKIP) + public Builder onNumberSeconds(Optional onNumberSeconds) { + this.onNumberSeconds = onNumberSeconds; + return this; + } + + public Builder onNumberSeconds(Double onNumberSeconds) { + this.onNumberSeconds = Optional.ofNullable(onNumberSeconds); + return this; + } + + public TranscriptionEndpointingPlan build() { + return new TranscriptionEndpointingPlan( + onPunctuationSeconds, onNoPunctuationSeconds, onNumberSeconds, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TransferCallTool.java b/src/main/java/com/vapi/api/types/TransferCallTool.java new file mode 100644 index 0000000..878a808 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TransferCallTool.java @@ -0,0 +1,428 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TransferCallTool.Builder.class) +public final class TransferCallTool { + private final Optional async; + + private final Optional> messages; + + private final Optional> destinations; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional function; + + private final Optional server; + + private final Map additionalProperties; + + private TransferCallTool( + Optional async, + Optional> messages, + Optional> destinations, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional function, + Optional server, + Map additionalProperties) { + this.async = async; + this.messages = messages; + this.destinations = destinations; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.function = function; + this.server = server; + this.additionalProperties = additionalProperties; + } + + /** + * @return This determines if the tool is async. + *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ */ + @JsonProperty("async") + public Optional getAsync() { + return async; + } + + /** + * @return These are the messages that will be spoken to the user as the tool is running. + *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return These are the destinations that the call can be transferred to. If no destinations are provided, server.url will be used to get the transfer destination once the tool is called. + */ + @JsonProperty("destinations") + public Optional> getDestinations() { + return destinations; + } + + /** + * @return This is the unique identifier for the tool. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the organization that this tool belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the tool was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the tool was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the function definition of the tool. + *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ */ + @JsonProperty("function") + public Optional getFunction() { + return function; + } + + /** + * @return This is the server that will be hit when this tool is requested by the model. + *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ */ + @JsonProperty("server") + public Optional getServer() { + return server; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallTool && equalTo((TransferCallTool) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TransferCallTool other) { + return async.equals(other.async) + && messages.equals(other.messages) + && destinations.equals(other.destinations) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && function.equals(other.function) + && server.equals(other.server); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.async, + this.messages, + this.destinations, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.function, + this.server); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(TransferCallTool other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + TransferCallTool build(); + + _FinalStage async(Optional async); + + _FinalStage async(Boolean async); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage destinations(Optional> destinations); + + _FinalStage destinations(List destinations); + + _FinalStage function(Optional function); + + _FinalStage function(OpenAiFunction function); + + _FinalStage server(Optional server); + + _FinalStage server(Server server); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional server = Optional.empty(); + + private Optional function = Optional.empty(); + + private Optional> destinations = Optional.empty(); + + private Optional> messages = Optional.empty(); + + private Optional async = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TransferCallTool other) { + async(other.getAsync()); + messages(other.getMessages()); + destinations(other.getDestinations()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + function(other.getFunction()); + server(other.getServer()); + return this; + } + + /** + *

This is the unique identifier for the tool.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the organization that this tool belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the tool was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the tool was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the server that will be hit when this tool is requested by the model.

+ *

All requests will be sent with the call object among other things. You can find more details in the Server URL documentation.

+ *

This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage server(Server server) { + this.server = Optional.ofNullable(server); + return this; + } + + @java.lang.Override + @JsonSetter(value = "server", nulls = Nulls.SKIP) + public _FinalStage server(Optional server) { + this.server = server; + return this; + } + + /** + *

This is the function definition of the tool.

+ *

For endCall, transferCall, and dtmf tools, this is auto-filled based on tool-specific fields like tool.destinations. But, even in those cases, you can provide a custom function definition for advanced use cases.

+ *

An example of an advanced use case is if you want to customize the message that's spoken for endCall tool. You can specify a function where it returns an argument "reason". Then, in messages array, you can have many "request-complete" messages. One of these messages will be triggered if the messages[].conditions matches the "reason" argument.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage function(OpenAiFunction function) { + this.function = Optional.ofNullable(function); + return this; + } + + @java.lang.Override + @JsonSetter(value = "function", nulls = Nulls.SKIP) + public _FinalStage function(Optional function) { + this.function = function; + return this; + } + + /** + *

These are the destinations that the call can be transferred to. If no destinations are provided, server.url will be used to get the transfer destination once the tool is called.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage destinations(List destinations) { + this.destinations = Optional.ofNullable(destinations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "destinations", nulls = Nulls.SKIP) + public _FinalStage destinations(Optional> destinations) { + this.destinations = destinations; + return this; + } + + /** + *

These are the messages that will be spoken to the user as the tool is running.

+ *

For some tools, this is auto-filled based on special fields like tool.destinations. For others like the function tool, these can be custom configured.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + /** + *

This determines if the tool is async.

+ *

If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server.

+ *

If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server.

+ *

Defaults to synchronous (false).

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage async(Boolean async) { + this.async = Optional.ofNullable(async); + return this; + } + + @java.lang.Override + @JsonSetter(value = "async", nulls = Nulls.SKIP) + public _FinalStage async(Optional async) { + this.async = async; + return this; + } + + @java.lang.Override + public TransferCallTool build() { + return new TransferCallTool( + async, + messages, + destinations, + id, + orgId, + createdAt, + updatedAt, + function, + server, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TransferCallToolDestinationsItem.java b/src/main/java/com/vapi/api/types/TransferCallToolDestinationsItem.java new file mode 100644 index 0000000..73cc643 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TransferCallToolDestinationsItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class TransferCallToolDestinationsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private TransferCallToolDestinationsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static TransferCallToolDestinationsItem assistant(TransferDestinationAssistant value) { + return new TransferCallToolDestinationsItem(new AssistantValue(value)); + } + + public static TransferCallToolDestinationsItem step(TransferDestinationStep value) { + return new TransferCallToolDestinationsItem(new StepValue(value)); + } + + public static TransferCallToolDestinationsItem number(TransferDestinationNumber value) { + return new TransferCallToolDestinationsItem(new NumberValue(value)); + } + + public static TransferCallToolDestinationsItem sip(TransferDestinationSip value) { + return new TransferCallToolDestinationsItem(new SipValue(value)); + } + + public boolean isAssistant() { + return value instanceof AssistantValue; + } + + public boolean isStep() { + return value instanceof StepValue; + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getAssistant() { + if (isAssistant()) { + return Optional.of(((AssistantValue) value).value); + } + return Optional.empty(); + } + + public Optional getStep() { + if (isStep()) { + return Optional.of(((StepValue) value).value); + } + return Optional.empty(); + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitAssistant(TransferDestinationAssistant assistant); + + T visitStep(TransferDestinationStep step); + + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(AssistantValue.class), + @JsonSubTypes.Type(StepValue.class), + @JsonSubTypes.Type(NumberValue.class), + @JsonSubTypes.Type(SipValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("assistant") + private static final class AssistantValue implements Value { + @JsonUnwrapped + private TransferDestinationAssistant value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private AssistantValue() {} + + private AssistantValue(TransferDestinationAssistant value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitAssistant(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AssistantValue && equalTo((AssistantValue) other); + } + + private boolean equalTo(AssistantValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TransferCallToolDestinationsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("step") + private static final class StepValue implements Value { + @JsonUnwrapped + private TransferDestinationStep value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private StepValue() {} + + private StepValue(TransferDestinationStep value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitStep(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StepValue && equalTo((StepValue) other); + } + + private boolean equalTo(StepValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TransferCallToolDestinationsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TransferCallToolDestinationsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TransferCallToolDestinationsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "TransferCallToolDestinationsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/TransferCallToolMessagesItem.java b/src/main/java/com/vapi/api/types/TransferCallToolMessagesItem.java new file mode 100644 index 0000000..f9a65b3 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TransferCallToolMessagesItem.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class TransferCallToolMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private TransferCallToolMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static TransferCallToolMessagesItem requestStart(ToolMessageStart value) { + return new TransferCallToolMessagesItem(new RequestStartValue(value)); + } + + public static TransferCallToolMessagesItem requestComplete(ToolMessageComplete value) { + return new TransferCallToolMessagesItem(new RequestCompleteValue(value)); + } + + public static TransferCallToolMessagesItem requestFailed(ToolMessageFailed value) { + return new TransferCallToolMessagesItem(new RequestFailedValue(value)); + } + + public static TransferCallToolMessagesItem requestResponseDelayed(ToolMessageDelayed value) { + return new TransferCallToolMessagesItem(new RequestResponseDelayedValue(value)); + } + + public boolean isRequestStart() { + return value instanceof RequestStartValue; + } + + public boolean isRequestComplete() { + return value instanceof RequestCompleteValue; + } + + public boolean isRequestFailed() { + return value instanceof RequestFailedValue; + } + + public boolean isRequestResponseDelayed() { + return value instanceof RequestResponseDelayedValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getRequestStart() { + if (isRequestStart()) { + return Optional.of(((RequestStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestComplete() { + if (isRequestComplete()) { + return Optional.of(((RequestCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestFailed() { + if (isRequestFailed()) { + return Optional.of(((RequestFailedValue) value).value); + } + return Optional.empty(); + } + + public Optional getRequestResponseDelayed() { + if (isRequestResponseDelayed()) { + return Optional.of(((RequestResponseDelayedValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitRequestStart(ToolMessageStart requestStart); + + T visitRequestComplete(ToolMessageComplete requestComplete); + + T visitRequestFailed(ToolMessageFailed requestFailed); + + T visitRequestResponseDelayed(ToolMessageDelayed requestResponseDelayed); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(RequestStartValue.class), + @JsonSubTypes.Type(RequestCompleteValue.class), + @JsonSubTypes.Type(RequestFailedValue.class), + @JsonSubTypes.Type(RequestResponseDelayedValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("request-start") + private static final class RequestStartValue implements Value { + @JsonUnwrapped + private ToolMessageStart value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestStartValue() {} + + private RequestStartValue(ToolMessageStart value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestStartValue && equalTo((RequestStartValue) other); + } + + private boolean equalTo(RequestStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TransferCallToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-complete") + private static final class RequestCompleteValue implements Value { + @JsonUnwrapped + private ToolMessageComplete value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestCompleteValue() {} + + private RequestCompleteValue(ToolMessageComplete value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestCompleteValue && equalTo((RequestCompleteValue) other); + } + + private boolean equalTo(RequestCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TransferCallToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-failed") + private static final class RequestFailedValue implements Value { + @JsonUnwrapped + private ToolMessageFailed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestFailedValue() {} + + private RequestFailedValue(ToolMessageFailed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestFailed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestFailedValue && equalTo((RequestFailedValue) other); + } + + private boolean equalTo(RequestFailedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TransferCallToolMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("request-response-delayed") + private static final class RequestResponseDelayedValue implements Value { + @JsonUnwrapped + private ToolMessageDelayed value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private RequestResponseDelayedValue() {} + + private RequestResponseDelayedValue(ToolMessageDelayed value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitRequestResponseDelayed(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RequestResponseDelayedValue && equalTo((RequestResponseDelayedValue) other); + } + + private boolean equalTo(RequestResponseDelayedValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TransferCallToolMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "TransferCallToolMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/TransferDestinationAssistant.java b/src/main/java/com/vapi/api/types/TransferDestinationAssistant.java new file mode 100644 index 0000000..7c8b9f0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TransferDestinationAssistant.java @@ -0,0 +1,311 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TransferDestinationAssistant.Builder.class) +public final class TransferDestinationAssistant { + private final Optional transferMode; + + private final String assistantName; + + private final Optional message; + + private final Optional description; + + private final Map additionalProperties; + + private TransferDestinationAssistant( + Optional transferMode, + String assistantName, + Optional message, + Optional description, + Map additionalProperties) { + this.transferMode = transferMode; + this.assistantName = assistantName; + this.message = message; + this.description = description; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the mode to use for the transfer. Default is rolling-history. + *
    + *
  • + *

    rolling-history: This is the default mode. It keeps the entire conversation history and appends the new assistant's system message on transfer.

    + *

    Example:

    + *

    Pre-transfer: + * system: assistant1 system message + * assistant: assistant1 first message + * user: hey, good morning + * assistant: how can i help? + * user: i need help with my account + * assistant: (destination.message)

    + *

    Post-transfer: + * system: assistant1 system message + * assistant: assistant1 first message + * user: hey, good morning + * assistant: how can i help? + * user: i need help with my account + * assistant: (destination.message) + * system: assistant2 system message + * assistant: assistant2 first message (or model generated if firstMessageMode is set to assistant-speaks-first-with-model-generated-message)

    + *
  • + *
  • + *

    swap-system-message-in-history: This replaces the original system message with the new assistant's system message on transfer.

    + *

    Example:

    + *

    Pre-transfer: + * system: assistant1 system message + * assistant: assistant1 first message + * user: hey, good morning + * assistant: how can i help? + * user: i need help with my account + * assistant: (destination.message)

    + *

    Post-transfer: + * system: assistant2 system message + * assistant: assistant1 first message + * user: hey, good morning + * assistant: how can i help? + * user: i need help with my account + * assistant: (destination.message) + * assistant: assistant2 first message (or model generated if firstMessageMode is set to assistant-speaks-first-with-model-generated-message)

    + *
  • + *
+ */ + @JsonProperty("transferMode") + public Optional getTransferMode() { + return transferMode; + } + + /** + * @return This is the assistant to transfer the call to. + */ + @JsonProperty("assistantName") + public String getAssistantName() { + return assistantName; + } + + /** + * @return This is the message to say before transferring the call to the destination. + *

If this is not provided and transfer tool messages is not provided, default is "Transferring the call now".

+ *

If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message for the destination assistant.

+ */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + /** + * @return This is the description of the destination, used by the AI to choose when and how to transfer the call. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferDestinationAssistant && equalTo((TransferDestinationAssistant) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TransferDestinationAssistant other) { + return transferMode.equals(other.transferMode) + && assistantName.equals(other.assistantName) + && message.equals(other.message) + && description.equals(other.description); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.transferMode, this.assistantName, this.message, this.description); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AssistantNameStage builder() { + return new Builder(); + } + + public interface AssistantNameStage { + _FinalStage assistantName(@NotNull String assistantName); + + Builder from(TransferDestinationAssistant other); + } + + public interface _FinalStage { + TransferDestinationAssistant build(); + + _FinalStage transferMode(Optional transferMode); + + _FinalStage transferMode(TransferMode transferMode); + + _FinalStage message(Optional message); + + _FinalStage message(String message); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AssistantNameStage, _FinalStage { + private String assistantName; + + private Optional description = Optional.empty(); + + private Optional message = Optional.empty(); + + private Optional transferMode = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TransferDestinationAssistant other) { + transferMode(other.getTransferMode()); + assistantName(other.getAssistantName()); + message(other.getMessage()); + description(other.getDescription()); + return this; + } + + /** + *

This is the assistant to transfer the call to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("assistantName") + public _FinalStage assistantName(@NotNull String assistantName) { + this.assistantName = Objects.requireNonNull(assistantName, "assistantName must not be null"); + return this; + } + + /** + *

This is the description of the destination, used by the AI to choose when and how to transfer the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

This is the message to say before transferring the call to the destination.

+ *

If this is not provided and transfer tool messages is not provided, default is "Transferring the call now".

+ *

If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message for the destination assistant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + @java.lang.Override + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public _FinalStage message(Optional message) { + this.message = message; + return this; + } + + /** + *

This is the mode to use for the transfer. Default is rolling-history.

+ *
    + *
  • + *

    rolling-history: This is the default mode. It keeps the entire conversation history and appends the new assistant's system message on transfer.

    + *

    Example:

    + *

    Pre-transfer: + * system: assistant1 system message + * assistant: assistant1 first message + * user: hey, good morning + * assistant: how can i help? + * user: i need help with my account + * assistant: (destination.message)

    + *

    Post-transfer: + * system: assistant1 system message + * assistant: assistant1 first message + * user: hey, good morning + * assistant: how can i help? + * user: i need help with my account + * assistant: (destination.message) + * system: assistant2 system message + * assistant: assistant2 first message (or model generated if firstMessageMode is set to assistant-speaks-first-with-model-generated-message)

    + *
  • + *
  • + *

    swap-system-message-in-history: This replaces the original system message with the new assistant's system message on transfer.

    + *

    Example:

    + *

    Pre-transfer: + * system: assistant1 system message + * assistant: assistant1 first message + * user: hey, good morning + * assistant: how can i help? + * user: i need help with my account + * assistant: (destination.message)

    + *

    Post-transfer: + * system: assistant2 system message + * assistant: assistant1 first message + * user: hey, good morning + * assistant: how can i help? + * user: i need help with my account + * assistant: (destination.message) + * assistant: assistant2 first message (or model generated if firstMessageMode is set to assistant-speaks-first-with-model-generated-message)

    + *
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage transferMode(TransferMode transferMode) { + this.transferMode = Optional.ofNullable(transferMode); + return this; + } + + @java.lang.Override + @JsonSetter(value = "transferMode", nulls = Nulls.SKIP) + public _FinalStage transferMode(Optional transferMode) { + this.transferMode = transferMode; + return this; + } + + @java.lang.Override + public TransferDestinationAssistant build() { + return new TransferDestinationAssistant( + transferMode, assistantName, message, description, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TransferDestinationNumber.java b/src/main/java/com/vapi/api/types/TransferDestinationNumber.java new file mode 100644 index 0000000..d5679a4 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TransferDestinationNumber.java @@ -0,0 +1,341 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TransferDestinationNumber.Builder.class) +public final class TransferDestinationNumber { + private final Optional numberE164CheckEnabled; + + private final String number; + + private final Optional extension; + + private final Optional callerId; + + private final Optional message; + + private final Optional description; + + private final Map additionalProperties; + + private TransferDestinationNumber( + Optional numberE164CheckEnabled, + String number, + Optional extension, + Optional callerId, + Optional message, + Optional description, + Map additionalProperties) { + this.numberE164CheckEnabled = numberE164CheckEnabled; + this.number = number; + this.extension = extension; + this.callerId = callerId; + this.message = message; + this.description = description; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the flag to toggle the E164 check for the number field. This is an advanced property which should be used if you know your use case requires it. + *

Use cases:

+ *
    + *
  • false: To allow non-E164 numbers like +001234567890, 1234, or abc. This is useful for dialing out to non-E164 numbers on your SIP trunks.
  • + *
  • true (default): To allow only E164 numbers like +14155551234. This is standard for PSTN calls.
  • + *
+ *

If false, the number is still required to only contain alphanumeric characters (regex: /^\+?[a-zA-Z0-9]+$/).

+ *

@default true (E164 check is enabled)

+ */ + @JsonProperty("numberE164CheckEnabled") + public Optional getNumberE164CheckEnabled() { + return numberE164CheckEnabled; + } + + /** + * @return This is the phone number to transfer the call to. + */ + @JsonProperty("number") + public String getNumber() { + return number; + } + + /** + * @return This is the extension to dial after transferring the call to the number. + */ + @JsonProperty("extension") + public Optional getExtension() { + return extension; + } + + /** + * @return This is the caller ID to use when transferring the call to the number. + *

Usage:

+ *
    + *
  • If not provided, the caller ID will be the number the call is coming from. Example, +14151111111 calls in to and the assistant transfers out to +16470000000. +16470000000 will see +14151111111 as the caller.
  • + *
  • To change this behavior, provide a callerId.
  • + *
  • Set to '{{customer.number}}' to always use the customer's number as the caller ID.
  • + *
  • Set to '{{phoneNumber.number}}' to always use the phone number of the assistant as the caller ID.
  • + *
  • Set to any E164 number to always use that number as the caller ID. This needs to be a number that is owned or verified by your Transport provider like Twilio.
  • + *
+ *

For Twilio, you can read up more here: https://www.twilio.com/docs/voice/twiml/dial#callerid

+ */ + @JsonProperty("callerId") + public Optional getCallerId() { + return callerId; + } + + /** + * @return This is the message to say before transferring the call to the destination. + *

If this is not provided and transfer tool messages is not provided, default is "Transferring the call now".

+ *

If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message for the destination assistant.

+ */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + /** + * @return This is the description of the destination, used by the AI to choose when and how to transfer the call. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferDestinationNumber && equalTo((TransferDestinationNumber) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TransferDestinationNumber other) { + return numberE164CheckEnabled.equals(other.numberE164CheckEnabled) + && number.equals(other.number) + && extension.equals(other.extension) + && callerId.equals(other.callerId) + && message.equals(other.message) + && description.equals(other.description); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.numberE164CheckEnabled, + this.number, + this.extension, + this.callerId, + this.message, + this.description); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NumberStage builder() { + return new Builder(); + } + + public interface NumberStage { + _FinalStage number(@NotNull String number); + + Builder from(TransferDestinationNumber other); + } + + public interface _FinalStage { + TransferDestinationNumber build(); + + _FinalStage numberE164CheckEnabled(Optional numberE164CheckEnabled); + + _FinalStage numberE164CheckEnabled(Boolean numberE164CheckEnabled); + + _FinalStage extension(Optional extension); + + _FinalStage extension(String extension); + + _FinalStage callerId(Optional callerId); + + _FinalStage callerId(String callerId); + + _FinalStage message(Optional message); + + _FinalStage message(String message); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NumberStage, _FinalStage { + private String number; + + private Optional description = Optional.empty(); + + private Optional message = Optional.empty(); + + private Optional callerId = Optional.empty(); + + private Optional extension = Optional.empty(); + + private Optional numberE164CheckEnabled = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TransferDestinationNumber other) { + numberE164CheckEnabled(other.getNumberE164CheckEnabled()); + number(other.getNumber()); + extension(other.getExtension()); + callerId(other.getCallerId()); + message(other.getMessage()); + description(other.getDescription()); + return this; + } + + /** + *

This is the phone number to transfer the call to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("number") + public _FinalStage number(@NotNull String number) { + this.number = Objects.requireNonNull(number, "number must not be null"); + return this; + } + + /** + *

This is the description of the destination, used by the AI to choose when and how to transfer the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

This is the message to say before transferring the call to the destination.

+ *

If this is not provided and transfer tool messages is not provided, default is "Transferring the call now".

+ *

If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message for the destination assistant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + @java.lang.Override + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public _FinalStage message(Optional message) { + this.message = message; + return this; + } + + /** + *

This is the caller ID to use when transferring the call to the number.

+ *

Usage:

+ *
    + *
  • If not provided, the caller ID will be the number the call is coming from. Example, +14151111111 calls in to and the assistant transfers out to +16470000000. +16470000000 will see +14151111111 as the caller.
  • + *
  • To change this behavior, provide a callerId.
  • + *
  • Set to '{{customer.number}}' to always use the customer's number as the caller ID.
  • + *
  • Set to '{{phoneNumber.number}}' to always use the phone number of the assistant as the caller ID.
  • + *
  • Set to any E164 number to always use that number as the caller ID. This needs to be a number that is owned or verified by your Transport provider like Twilio.
  • + *
+ *

For Twilio, you can read up more here: https://www.twilio.com/docs/voice/twiml/dial#callerid

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage callerId(String callerId) { + this.callerId = Optional.ofNullable(callerId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "callerId", nulls = Nulls.SKIP) + public _FinalStage callerId(Optional callerId) { + this.callerId = callerId; + return this; + } + + /** + *

This is the extension to dial after transferring the call to the number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage extension(String extension) { + this.extension = Optional.ofNullable(extension); + return this; + } + + @java.lang.Override + @JsonSetter(value = "extension", nulls = Nulls.SKIP) + public _FinalStage extension(Optional extension) { + this.extension = extension; + return this; + } + + /** + *

This is the flag to toggle the E164 check for the number field. This is an advanced property which should be used if you know your use case requires it.

+ *

Use cases:

+ *
    + *
  • false: To allow non-E164 numbers like +001234567890, 1234, or abc. This is useful for dialing out to non-E164 numbers on your SIP trunks.
  • + *
  • true (default): To allow only E164 numbers like +14155551234. This is standard for PSTN calls.
  • + *
+ *

If false, the number is still required to only contain alphanumeric characters (regex: /^\+?[a-zA-Z0-9]+$/).

+ *

@default true (E164 check is enabled)

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numberE164CheckEnabled(Boolean numberE164CheckEnabled) { + this.numberE164CheckEnabled = Optional.ofNullable(numberE164CheckEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "numberE164CheckEnabled", nulls = Nulls.SKIP) + public _FinalStage numberE164CheckEnabled(Optional numberE164CheckEnabled) { + this.numberE164CheckEnabled = numberE164CheckEnabled; + return this; + } + + @java.lang.Override + public TransferDestinationNumber build() { + return new TransferDestinationNumber( + numberE164CheckEnabled, number, extension, callerId, message, description, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TransferDestinationSip.java b/src/main/java/com/vapi/api/types/TransferDestinationSip.java new file mode 100644 index 0000000..b32c4db --- /dev/null +++ b/src/main/java/com/vapi/api/types/TransferDestinationSip.java @@ -0,0 +1,189 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TransferDestinationSip.Builder.class) +public final class TransferDestinationSip { + private final String sipUri; + + private final Optional message; + + private final Optional description; + + private final Map additionalProperties; + + private TransferDestinationSip( + String sipUri, + Optional message, + Optional description, + Map additionalProperties) { + this.sipUri = sipUri; + this.message = message; + this.description = description; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the SIP URI to transfer the call to. + */ + @JsonProperty("sipUri") + public String getSipUri() { + return sipUri; + } + + /** + * @return This is the message to say before transferring the call to the destination. + *

If this is not provided and transfer tool messages is not provided, default is "Transferring the call now".

+ *

If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message for the destination assistant.

+ */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + /** + * @return This is the description of the destination, used by the AI to choose when and how to transfer the call. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferDestinationSip && equalTo((TransferDestinationSip) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TransferDestinationSip other) { + return sipUri.equals(other.sipUri) && message.equals(other.message) && description.equals(other.description); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.sipUri, this.message, this.description); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SipUriStage builder() { + return new Builder(); + } + + public interface SipUriStage { + _FinalStage sipUri(@NotNull String sipUri); + + Builder from(TransferDestinationSip other); + } + + public interface _FinalStage { + TransferDestinationSip build(); + + _FinalStage message(Optional message); + + _FinalStage message(String message); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SipUriStage, _FinalStage { + private String sipUri; + + private Optional description = Optional.empty(); + + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TransferDestinationSip other) { + sipUri(other.getSipUri()); + message(other.getMessage()); + description(other.getDescription()); + return this; + } + + /** + *

This is the SIP URI to transfer the call to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sipUri") + public _FinalStage sipUri(@NotNull String sipUri) { + this.sipUri = Objects.requireNonNull(sipUri, "sipUri must not be null"); + return this; + } + + /** + *

This is the description of the destination, used by the AI to choose when and how to transfer the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

This is the message to say before transferring the call to the destination.

+ *

If this is not provided and transfer tool messages is not provided, default is "Transferring the call now".

+ *

If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message for the destination assistant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + @java.lang.Override + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public _FinalStage message(Optional message) { + this.message = message; + return this; + } + + @java.lang.Override + public TransferDestinationSip build() { + return new TransferDestinationSip(sipUri, message, description, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TransferDestinationStep.java b/src/main/java/com/vapi/api/types/TransferDestinationStep.java new file mode 100644 index 0000000..0413abe --- /dev/null +++ b/src/main/java/com/vapi/api/types/TransferDestinationStep.java @@ -0,0 +1,191 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TransferDestinationStep.Builder.class) +public final class TransferDestinationStep { + private final String stepName; + + private final Optional message; + + private final Optional description; + + private final Map additionalProperties; + + private TransferDestinationStep( + String stepName, + Optional message, + Optional description, + Map additionalProperties) { + this.stepName = stepName; + this.message = message; + this.description = description; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the step to transfer to. + */ + @JsonProperty("stepName") + public String getStepName() { + return stepName; + } + + /** + * @return This is the message to say before transferring the call to the destination. + *

If this is not provided and transfer tool messages is not provided, default is "Transferring the call now".

+ *

If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message for the destination assistant.

+ */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + /** + * @return This is the description of the destination, used by the AI to choose when and how to transfer the call. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferDestinationStep && equalTo((TransferDestinationStep) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TransferDestinationStep other) { + return stepName.equals(other.stepName) + && message.equals(other.message) + && description.equals(other.description); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.stepName, this.message, this.description); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static StepNameStage builder() { + return new Builder(); + } + + public interface StepNameStage { + _FinalStage stepName(@NotNull String stepName); + + Builder from(TransferDestinationStep other); + } + + public interface _FinalStage { + TransferDestinationStep build(); + + _FinalStage message(Optional message); + + _FinalStage message(String message); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements StepNameStage, _FinalStage { + private String stepName; + + private Optional description = Optional.empty(); + + private Optional message = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TransferDestinationStep other) { + stepName(other.getStepName()); + message(other.getMessage()); + description(other.getDescription()); + return this; + } + + /** + *

This is the step to transfer to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("stepName") + public _FinalStage stepName(@NotNull String stepName) { + this.stepName = Objects.requireNonNull(stepName, "stepName must not be null"); + return this; + } + + /** + *

This is the description of the destination, used by the AI to choose when and how to transfer the call.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

This is the message to say before transferring the call to the destination.

+ *

If this is not provided and transfer tool messages is not provided, default is "Transferring the call now".

+ *

If set to "", nothing is spoken. This is useful when you want to silently transfer. This is especially useful when transferring between assistants in a squad. In this scenario, you likely also want to set assistant.firstMessageMode=assistant-speaks-first-with-model-generated-message for the destination assistant.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage message(String message) { + this.message = Optional.ofNullable(message); + return this; + } + + @java.lang.Override + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public _FinalStage message(Optional message) { + this.message = message; + return this; + } + + @java.lang.Override + public TransferDestinationStep build() { + return new TransferDestinationStep(stepName, message, description, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TransferMode.java b/src/main/java/com/vapi/api/types/TransferMode.java new file mode 100644 index 0000000..ab37772 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TransferMode.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum TransferMode { + ROLLING_HISTORY("rolling-history"), + + SWAP_SYSTEM_MESSAGE_IN_HISTORY("swap-system-message-in-history"); + + private final String value; + + TransferMode(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/TransportConfigurationTwilio.java b/src/main/java/com/vapi/api/types/TransportConfigurationTwilio.java new file mode 100644 index 0000000..00be15f --- /dev/null +++ b/src/main/java/com/vapi/api/types/TransportConfigurationTwilio.java @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TransportConfigurationTwilio.Builder.class) +public final class TransportConfigurationTwilio { + private final Optional timeout; + + private final Optional record; + + private final Optional recordingChannels; + + private final Map additionalProperties; + + private TransportConfigurationTwilio( + Optional timeout, + Optional record, + Optional recordingChannels, + Map additionalProperties) { + this.timeout = timeout; + this.record = record; + this.recordingChannels = recordingChannels; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "twilio"; + } + + /** + * @return The integer number of seconds that we should allow the phone to ring before assuming there is no answer. + * The default is 60 seconds and the maximum is 600 seconds. + * For some call flows, we will add a 5-second buffer to the timeout value you provide. + * For this reason, a timeout value of 10 seconds could result in an actual timeout closer to 15 seconds. + * You can set this to a short time, such as 15 seconds, to hang up before reaching an answering machine or voicemail. + *

@default 60

+ */ + @JsonProperty("timeout") + public Optional getTimeout() { + return timeout; + } + + /** + * @return Whether to record the call. + * Can be true to record the phone call, or false to not. + * The default is false. + *

@default false

+ */ + @JsonProperty("record") + public Optional getRecord() { + return record; + } + + /** + * @return The number of channels in the final recording. + * Can be: mono or dual. + * The default is mono. + * mono records both legs of the call in a single channel of the recording file. + * dual records each leg to a separate channel of the recording file. + * The first channel of a dual-channel recording contains the parent call and the second channel contains the child call. + *

@default 'mono'

+ */ + @JsonProperty("recordingChannels") + public Optional getRecordingChannels() { + return recordingChannels; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransportConfigurationTwilio && equalTo((TransportConfigurationTwilio) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TransportConfigurationTwilio other) { + return timeout.equals(other.timeout) + && record.equals(other.record) + && recordingChannels.equals(other.recordingChannels); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.timeout, this.record, this.recordingChannels); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional timeout = Optional.empty(); + + private Optional record = Optional.empty(); + + private Optional recordingChannels = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TransportConfigurationTwilio other) { + timeout(other.getTimeout()); + record(other.getRecord()); + recordingChannels(other.getRecordingChannels()); + return this; + } + + @JsonSetter(value = "timeout", nulls = Nulls.SKIP) + public Builder timeout(Optional timeout) { + this.timeout = timeout; + return this; + } + + public Builder timeout(Double timeout) { + this.timeout = Optional.ofNullable(timeout); + return this; + } + + @JsonSetter(value = "record", nulls = Nulls.SKIP) + public Builder record(Optional record) { + this.record = record; + return this; + } + + public Builder record(Boolean record) { + this.record = Optional.ofNullable(record); + return this; + } + + @JsonSetter(value = "recordingChannels", nulls = Nulls.SKIP) + public Builder recordingChannels(Optional recordingChannels) { + this.recordingChannels = recordingChannels; + return this; + } + + public Builder recordingChannels(TransportConfigurationTwilioRecordingChannels recordingChannels) { + this.recordingChannels = Optional.ofNullable(recordingChannels); + return this; + } + + public TransportConfigurationTwilio build() { + return new TransportConfigurationTwilio(timeout, record, recordingChannels, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TransportConfigurationTwilioRecordingChannels.java b/src/main/java/com/vapi/api/types/TransportConfigurationTwilioRecordingChannels.java new file mode 100644 index 0000000..9bed24e --- /dev/null +++ b/src/main/java/com/vapi/api/types/TransportConfigurationTwilioRecordingChannels.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum TransportConfigurationTwilioRecordingChannels { + MONO("mono"), + + DUAL("dual"); + + private final String value; + + TransportConfigurationTwilioRecordingChannels(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/TransportCost.java b/src/main/java/com/vapi/api/types/TransportCost.java new file mode 100644 index 0000000..31b352d --- /dev/null +++ b/src/main/java/com/vapi/api/types/TransportCost.java @@ -0,0 +1,137 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TransportCost.Builder.class) +public final class TransportCost { + private final double minutes; + + private final double cost; + + private final Map additionalProperties; + + private TransportCost(double minutes, double cost, Map additionalProperties) { + this.minutes = minutes; + this.cost = cost; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the minutes of transport usage. This should match call.endedAt - call.startedAt. + */ + @JsonProperty("minutes") + public double getMinutes() { + return minutes; + } + + /** + * @return This is the cost of the component in USD. + */ + @JsonProperty("cost") + public double getCost() { + return cost; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransportCost && equalTo((TransportCost) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TransportCost other) { + return minutes == other.minutes && cost == other.cost; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.minutes, this.cost); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MinutesStage builder() { + return new Builder(); + } + + public interface MinutesStage { + CostStage minutes(double minutes); + + Builder from(TransportCost other); + } + + public interface CostStage { + _FinalStage cost(double cost); + } + + public interface _FinalStage { + TransportCost build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MinutesStage, CostStage, _FinalStage { + private double minutes; + + private double cost; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TransportCost other) { + minutes(other.getMinutes()); + cost(other.getCost()); + return this; + } + + /** + *

This is the minutes of transport usage. This should match call.endedAt - call.startedAt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("minutes") + public CostStage minutes(double minutes) { + this.minutes = minutes; + return this; + } + + /** + *

This is the cost of the component in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cost") + public _FinalStage cost(double cost) { + this.cost = cost; + return this; + } + + @java.lang.Override + public TransportCost build() { + return new TransportCost(minutes, cost, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TwilioCredential.java b/src/main/java/com/vapi/api/types/TwilioCredential.java new file mode 100644 index 0000000..d82734b --- /dev/null +++ b/src/main/java/com/vapi/api/types/TwilioCredential.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TwilioCredential.Builder.class) +public final class TwilioCredential { + private final String authToken; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final String accountSid; + + private final Map additionalProperties; + + private TwilioCredential( + String authToken, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + String accountSid, + Map additionalProperties) { + this.authToken = authToken; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.accountSid = accountSid; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "twilio"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("authToken") + public String getAuthToken() { + return authToken; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @JsonProperty("accountSid") + public String getAccountSid() { + return accountSid; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioCredential && equalTo((TwilioCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TwilioCredential other) { + return authToken.equals(other.authToken) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && accountSid.equals(other.accountSid); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.authToken, this.id, this.orgId, this.createdAt, this.updatedAt, this.accountSid); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AuthTokenStage builder() { + return new Builder(); + } + + public interface AuthTokenStage { + IdStage authToken(@NotNull String authToken); + + Builder from(TwilioCredential other); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + AccountSidStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface AccountSidStage { + _FinalStage accountSid(@NotNull String accountSid); + } + + public interface _FinalStage { + TwilioCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AuthTokenStage, + IdStage, + OrgIdStage, + CreatedAtStage, + UpdatedAtStage, + AccountSidStage, + _FinalStage { + private String authToken; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private String accountSid; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TwilioCredential other) { + authToken(other.getAuthToken()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + accountSid(other.getAccountSid()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("authToken") + public IdStage authToken(@NotNull String authToken) { + this.authToken = Objects.requireNonNull(authToken, "authToken must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public AccountSidStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("accountSid") + public _FinalStage accountSid(@NotNull String accountSid) { + this.accountSid = Objects.requireNonNull(accountSid, "accountSid must not be null"); + return this; + } + + @java.lang.Override + public TwilioCredential build() { + return new TwilioCredential(authToken, id, orgId, createdAt, updatedAt, accountSid, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TwilioPhoneNumber.java b/src/main/java/com/vapi/api/types/TwilioPhoneNumber.java new file mode 100644 index 0000000..da96adb --- /dev/null +++ b/src/main/java/com/vapi/api/types/TwilioPhoneNumber.java @@ -0,0 +1,579 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TwilioPhoneNumber.Builder.class) +public final class TwilioPhoneNumber { + private final Optional fallbackDestination; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional name; + + private final Optional assistantId; + + private final Optional squadId; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final String number; + + private final String twilioAccountSid; + + private final String twilioAuthToken; + + private final Map additionalProperties; + + private TwilioPhoneNumber( + Optional fallbackDestination, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional name, + Optional assistantId, + Optional squadId, + Optional serverUrl, + Optional serverUrlSecret, + String number, + String twilioAccountSid, + String twilioAuthToken, + Map additionalProperties) { + this.fallbackDestination = fallbackDestination; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.name = name; + this.assistantId = assistantId; + this.squadId = squadId; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.number = number; + this.twilioAccountSid = twilioAccountSid; + this.twilioAuthToken = twilioAuthToken; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the fallback destination an inbound call will be transferred to if: + *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ */ + @JsonProperty("fallbackDestination") + public Optional getFallbackDestination() { + return fallbackDestination; + } + + /** + * @return This is the unique identifier for the phone number. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this phone number belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the phone number was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the phone number was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the name of the phone number. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the assistant that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the squad that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message. + *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + /** + * @return These are the digits of the phone number you own on your Twilio. + */ + @JsonProperty("number") + public String getNumber() { + return number; + } + + /** + * @return This is the Twilio Account SID for the phone number. + */ + @JsonProperty("twilioAccountSid") + public String getTwilioAccountSid() { + return twilioAccountSid; + } + + /** + * @return This is the Twilio Auth Token for the phone number. + */ + @JsonProperty("twilioAuthToken") + public String getTwilioAuthToken() { + return twilioAuthToken; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioPhoneNumber && equalTo((TwilioPhoneNumber) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TwilioPhoneNumber other) { + return fallbackDestination.equals(other.fallbackDestination) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && name.equals(other.name) + && assistantId.equals(other.assistantId) + && squadId.equals(other.squadId) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret) + && number.equals(other.number) + && twilioAccountSid.equals(other.twilioAccountSid) + && twilioAuthToken.equals(other.twilioAuthToken); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fallbackDestination, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.name, + this.assistantId, + this.squadId, + this.serverUrl, + this.serverUrlSecret, + this.number, + this.twilioAccountSid, + this.twilioAuthToken); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(TwilioPhoneNumber other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + NumberStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface NumberStage { + TwilioAccountSidStage number(@NotNull String number); + } + + public interface TwilioAccountSidStage { + TwilioAuthTokenStage twilioAccountSid(@NotNull String twilioAccountSid); + } + + public interface TwilioAuthTokenStage { + _FinalStage twilioAuthToken(@NotNull String twilioAuthToken); + } + + public interface _FinalStage { + TwilioPhoneNumber build(); + + _FinalStage fallbackDestination(Optional fallbackDestination); + + _FinalStage fallbackDestination(TwilioPhoneNumberFallbackDestination fallbackDestination); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage assistantId(Optional assistantId); + + _FinalStage assistantId(String assistantId); + + _FinalStage squadId(Optional squadId); + + _FinalStage squadId(String squadId); + + _FinalStage serverUrl(Optional serverUrl); + + _FinalStage serverUrl(String serverUrl); + + _FinalStage serverUrlSecret(Optional serverUrlSecret); + + _FinalStage serverUrlSecret(String serverUrlSecret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, + OrgIdStage, + CreatedAtStage, + UpdatedAtStage, + NumberStage, + TwilioAccountSidStage, + TwilioAuthTokenStage, + _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private String number; + + private String twilioAccountSid; + + private String twilioAuthToken; + + private Optional serverUrlSecret = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional fallbackDestination = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TwilioPhoneNumber other) { + fallbackDestination(other.getFallbackDestination()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + name(other.getName()); + assistantId(other.getAssistantId()); + squadId(other.getSquadId()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + number(other.getNumber()); + twilioAccountSid(other.getTwilioAccountSid()); + twilioAuthToken(other.getTwilioAuthToken()); + return this; + } + + /** + *

This is the unique identifier for the phone number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this phone number belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the phone number was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the phone number was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public NumberStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

These are the digits of the phone number you own on your Twilio.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("number") + public TwilioAccountSidStage number(@NotNull String number) { + this.number = Objects.requireNonNull(number, "number must not be null"); + return this; + } + + /** + *

This is the Twilio Account SID for the phone number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("twilioAccountSid") + public TwilioAuthTokenStage twilioAccountSid(@NotNull String twilioAccountSid) { + this.twilioAccountSid = Objects.requireNonNull(twilioAccountSid, "twilioAccountSid must not be null"); + return this; + } + + /** + *

This is the Twilio Auth Token for the phone number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("twilioAuthToken") + public _FinalStage twilioAuthToken(@NotNull String twilioAuthToken) { + this.twilioAuthToken = Objects.requireNonNull(twilioAuthToken, "twilioAuthToken must not be null"); + return this; + } + + /** + *

This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret.

+ *

Same precedence logic as serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public _FinalStage serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + /** + *

This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message.

+ *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public _FinalStage serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + /** + *

This is the squad that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public _FinalStage squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + /** + *

This is the assistant that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public _FinalStage assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + /** + *

This is the name of the phone number. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the fallback destination an inbound call will be transferred to if:

+ *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fallbackDestination(TwilioPhoneNumberFallbackDestination fallbackDestination) { + this.fallbackDestination = Optional.ofNullable(fallbackDestination); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fallbackDestination", nulls = Nulls.SKIP) + public _FinalStage fallbackDestination(Optional fallbackDestination) { + this.fallbackDestination = fallbackDestination; + return this; + } + + @java.lang.Override + public TwilioPhoneNumber build() { + return new TwilioPhoneNumber( + fallbackDestination, + id, + orgId, + createdAt, + updatedAt, + name, + assistantId, + squadId, + serverUrl, + serverUrlSecret, + number, + twilioAccountSid, + twilioAuthToken, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TwilioPhoneNumberFallbackDestination.java b/src/main/java/com/vapi/api/types/TwilioPhoneNumberFallbackDestination.java new file mode 100644 index 0000000..aa3dcb2 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TwilioPhoneNumberFallbackDestination.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class TwilioPhoneNumberFallbackDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private TwilioPhoneNumberFallbackDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static TwilioPhoneNumberFallbackDestination number(TransferDestinationNumber value) { + return new TwilioPhoneNumberFallbackDestination(new NumberValue(value)); + } + + public static TwilioPhoneNumberFallbackDestination sip(TransferDestinationSip value) { + return new TwilioPhoneNumberFallbackDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TwilioPhoneNumberFallbackDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "TwilioPhoneNumberFallbackDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "TwilioPhoneNumberFallbackDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/TwilioVoicemailDetection.java b/src/main/java/com/vapi/api/types/TwilioVoicemailDetection.java new file mode 100644 index 0000000..dda1b41 --- /dev/null +++ b/src/main/java/com/vapi/api/types/TwilioVoicemailDetection.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TwilioVoicemailDetection.Builder.class) +public final class TwilioVoicemailDetection { + private final Optional> voicemailDetectionTypes; + + private final Optional enabled; + + private final Optional machineDetectionTimeout; + + private final Optional machineDetectionSpeechThreshold; + + private final Optional machineDetectionSpeechEndThreshold; + + private final Optional machineDetectionSilenceTimeout; + + private final Map additionalProperties; + + private TwilioVoicemailDetection( + Optional> voicemailDetectionTypes, + Optional enabled, + Optional machineDetectionTimeout, + Optional machineDetectionSpeechThreshold, + Optional machineDetectionSpeechEndThreshold, + Optional machineDetectionSilenceTimeout, + Map additionalProperties) { + this.voicemailDetectionTypes = voicemailDetectionTypes; + this.enabled = enabled; + this.machineDetectionTimeout = machineDetectionTimeout; + this.machineDetectionSpeechThreshold = machineDetectionSpeechThreshold; + this.machineDetectionSpeechEndThreshold = machineDetectionSpeechEndThreshold; + this.machineDetectionSilenceTimeout = machineDetectionSilenceTimeout; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the provider to use for voicemail detection. + */ + @JsonProperty("provider") + public String getProvider() { + return "twilio"; + } + + /** + * @return These are the AMD messages from Twilio that are considered as voicemail. Default is ['machine_end_beep', 'machine_end_silence']. + *

@default {Array} ['machine_end_beep', 'machine_end_silence']

+ */ + @JsonProperty("voicemailDetectionTypes") + public Optional> getVoicemailDetectionTypes() { + return voicemailDetectionTypes; + } + + /** + * @return This sets whether the assistant should detect voicemail. Defaults to true. + *

@default true

+ */ + @JsonProperty("enabled") + public Optional getEnabled() { + return enabled; + } + + /** + * @return The number of seconds that Twilio should attempt to perform answering machine detection before timing out and returning AnsweredBy as unknown. Default is 30 seconds. + *

Increasing this value will provide the engine more time to make a determination. This can be useful when DetectMessageEnd is provided in the MachineDetection parameter and there is an expectation of long answering machine greetings that can exceed 30 seconds.

+ *

Decreasing this value will reduce the amount of time the engine has to make a determination. This can be particularly useful when the Enable option is provided in the MachineDetection parameter and you want to limit the time for initial detection.

+ *

Check the Twilio docs for more info.

+ *

@default 30

+ */ + @JsonProperty("machineDetectionTimeout") + public Optional getMachineDetectionTimeout() { + return machineDetectionTimeout; + } + + /** + * @return The number of milliseconds that is used as the measuring stick for the length of the speech activity. Durations lower than this value will be interpreted as a human, longer as a machine. Default is 2400 milliseconds. + *

Increasing this value will reduce the chance of a False Machine (detected machine, actually human) for a long human greeting (e.g., a business greeting) but increase the time it takes to detect a machine.

+ *

Decreasing this value will reduce the chances of a False Human (detected human, actually machine) for short voicemail greetings. The value of this parameter may need to be reduced by more than 1000ms to detect very short voicemail greetings. A reduction of that significance can result in increased False Machine detections. Adjusting the MachineDetectionSpeechEndThreshold is likely the better approach for short voicemails. Decreasing MachineDetectionSpeechThreshold will also reduce the time it takes to detect a machine.

+ *

Check the Twilio docs for more info.

+ *

@default 2400

+ */ + @JsonProperty("machineDetectionSpeechThreshold") + public Optional getMachineDetectionSpeechThreshold() { + return machineDetectionSpeechThreshold; + } + + /** + * @return The number of milliseconds of silence after speech activity at which point the speech activity is considered complete. Default is 1200 milliseconds. + *

Increasing this value will typically be used to better address the short voicemail greeting scenarios. For short voicemails, there is typically 1000-2000ms of audio followed by 1200-2400ms of silence and then additional audio before the beep. Increasing the MachineDetectionSpeechEndThreshold to ~2500ms will treat the 1200-2400ms of silence as a gap in the greeting but not the end of the greeting and will result in a machine detection. The downsides of such a change include:

+ *
    + *
  • Increasing the delay for human detection by the amount you increase this parameter, e.g., a change of 1200ms to 2500ms increases human detection delay by 1300ms.
  • + *
  • Cases where a human has two utterances separated by a period of silence (e.g. a "Hello", then 2000ms of silence, and another "Hello") may be interpreted as a machine.
  • + *
+ *

Decreasing this value will result in faster human detection. The consequence is that it can lead to increased False Human (detected human, actually machine) detections because a silence gap in a voicemail greeting (not necessarily just in short voicemail scenarios) can be incorrectly interpreted as the end of speech.

+ *

Check the Twilio docs for more info.

+ *

@default 1200

+ */ + @JsonProperty("machineDetectionSpeechEndThreshold") + public Optional getMachineDetectionSpeechEndThreshold() { + return machineDetectionSpeechEndThreshold; + } + + /** + * @return The number of milliseconds of initial silence after which an unknown AnsweredBy result will be returned. Default is 5000 milliseconds. + *

Increasing this value will result in waiting for a longer period of initial silence before returning an 'unknown' AMD result.

+ *

Decreasing this value will result in waiting for a shorter period of initial silence before returning an 'unknown' AMD result.

+ *

Check the Twilio docs for more info.

+ *

@default 5000

+ */ + @JsonProperty("machineDetectionSilenceTimeout") + public Optional getMachineDetectionSilenceTimeout() { + return machineDetectionSilenceTimeout; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TwilioVoicemailDetection && equalTo((TwilioVoicemailDetection) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TwilioVoicemailDetection other) { + return voicemailDetectionTypes.equals(other.voicemailDetectionTypes) + && enabled.equals(other.enabled) + && machineDetectionTimeout.equals(other.machineDetectionTimeout) + && machineDetectionSpeechThreshold.equals(other.machineDetectionSpeechThreshold) + && machineDetectionSpeechEndThreshold.equals(other.machineDetectionSpeechEndThreshold) + && machineDetectionSilenceTimeout.equals(other.machineDetectionSilenceTimeout); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.voicemailDetectionTypes, + this.enabled, + this.machineDetectionTimeout, + this.machineDetectionSpeechThreshold, + this.machineDetectionSpeechEndThreshold, + this.machineDetectionSilenceTimeout); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> voicemailDetectionTypes = + Optional.empty(); + + private Optional enabled = Optional.empty(); + + private Optional machineDetectionTimeout = Optional.empty(); + + private Optional machineDetectionSpeechThreshold = Optional.empty(); + + private Optional machineDetectionSpeechEndThreshold = Optional.empty(); + + private Optional machineDetectionSilenceTimeout = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TwilioVoicemailDetection other) { + voicemailDetectionTypes(other.getVoicemailDetectionTypes()); + enabled(other.getEnabled()); + machineDetectionTimeout(other.getMachineDetectionTimeout()); + machineDetectionSpeechThreshold(other.getMachineDetectionSpeechThreshold()); + machineDetectionSpeechEndThreshold(other.getMachineDetectionSpeechEndThreshold()); + machineDetectionSilenceTimeout(other.getMachineDetectionSilenceTimeout()); + return this; + } + + @JsonSetter(value = "voicemailDetectionTypes", nulls = Nulls.SKIP) + public Builder voicemailDetectionTypes( + Optional> voicemailDetectionTypes) { + this.voicemailDetectionTypes = voicemailDetectionTypes; + return this; + } + + public Builder voicemailDetectionTypes( + List voicemailDetectionTypes) { + this.voicemailDetectionTypes = Optional.ofNullable(voicemailDetectionTypes); + return this; + } + + @JsonSetter(value = "enabled", nulls = Nulls.SKIP) + public Builder enabled(Optional enabled) { + this.enabled = enabled; + return this; + } + + public Builder enabled(Boolean enabled) { + this.enabled = Optional.ofNullable(enabled); + return this; + } + + @JsonSetter(value = "machineDetectionTimeout", nulls = Nulls.SKIP) + public Builder machineDetectionTimeout(Optional machineDetectionTimeout) { + this.machineDetectionTimeout = machineDetectionTimeout; + return this; + } + + public Builder machineDetectionTimeout(Double machineDetectionTimeout) { + this.machineDetectionTimeout = Optional.ofNullable(machineDetectionTimeout); + return this; + } + + @JsonSetter(value = "machineDetectionSpeechThreshold", nulls = Nulls.SKIP) + public Builder machineDetectionSpeechThreshold(Optional machineDetectionSpeechThreshold) { + this.machineDetectionSpeechThreshold = machineDetectionSpeechThreshold; + return this; + } + + public Builder machineDetectionSpeechThreshold(Double machineDetectionSpeechThreshold) { + this.machineDetectionSpeechThreshold = Optional.ofNullable(machineDetectionSpeechThreshold); + return this; + } + + @JsonSetter(value = "machineDetectionSpeechEndThreshold", nulls = Nulls.SKIP) + public Builder machineDetectionSpeechEndThreshold(Optional machineDetectionSpeechEndThreshold) { + this.machineDetectionSpeechEndThreshold = machineDetectionSpeechEndThreshold; + return this; + } + + public Builder machineDetectionSpeechEndThreshold(Double machineDetectionSpeechEndThreshold) { + this.machineDetectionSpeechEndThreshold = Optional.ofNullable(machineDetectionSpeechEndThreshold); + return this; + } + + @JsonSetter(value = "machineDetectionSilenceTimeout", nulls = Nulls.SKIP) + public Builder machineDetectionSilenceTimeout(Optional machineDetectionSilenceTimeout) { + this.machineDetectionSilenceTimeout = machineDetectionSilenceTimeout; + return this; + } + + public Builder machineDetectionSilenceTimeout(Double machineDetectionSilenceTimeout) { + this.machineDetectionSilenceTimeout = Optional.ofNullable(machineDetectionSilenceTimeout); + return this; + } + + public TwilioVoicemailDetection build() { + return new TwilioVoicemailDetection( + voicemailDetectionTypes, + enabled, + machineDetectionTimeout, + machineDetectionSpeechThreshold, + machineDetectionSpeechEndThreshold, + machineDetectionSilenceTimeout, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/TwilioVoicemailDetectionVoicemailDetectionTypesItem.java b/src/main/java/com/vapi/api/types/TwilioVoicemailDetectionVoicemailDetectionTypesItem.java new file mode 100644 index 0000000..3a6586b --- /dev/null +++ b/src/main/java/com/vapi/api/types/TwilioVoicemailDetectionVoicemailDetectionTypesItem.java @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum TwilioVoicemailDetectionVoicemailDetectionTypesItem { + MACHINE_START("machine_start"), + + HUMAN("human"), + + FAX("fax"), + + UNKNOWN("unknown"), + + MACHINE_END_BEEP("machine_end_beep"), + + MACHINE_END_SILENCE("machine_end_silence"), + + MACHINE_END_OTHER("machine_end_other"); + + private final String value; + + TwilioVoicemailDetectionVoicemailDetectionTypesItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateAnthropicCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateAnthropicCredentialDto.java new file mode 100644 index 0000000..0c97e4c --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateAnthropicCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAnthropicCredentialDto.Builder.class) +public final class UpdateAnthropicCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdateAnthropicCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "anthropic"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAnthropicCredentialDto && equalTo((UpdateAnthropicCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAnthropicCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateAnthropicCredentialDto other); + } + + public interface _FinalStage { + UpdateAnthropicCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateAnthropicCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateAnthropicCredentialDto build() { + return new UpdateAnthropicCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateAnyscaleCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateAnyscaleCredentialDto.java new file mode 100644 index 0000000..c0caea1 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateAnyscaleCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAnyscaleCredentialDto.Builder.class) +public final class UpdateAnyscaleCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdateAnyscaleCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "anyscale"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAnyscaleCredentialDto && equalTo((UpdateAnyscaleCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAnyscaleCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateAnyscaleCredentialDto other); + } + + public interface _FinalStage { + UpdateAnyscaleCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateAnyscaleCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateAnyscaleCredentialDto build() { + return new UpdateAnyscaleCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateAzureOpenAiCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateAzureOpenAiCredentialDto.java new file mode 100644 index 0000000..6b02745 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateAzureOpenAiCredentialDto.java @@ -0,0 +1,206 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateAzureOpenAiCredentialDto.Builder.class) +public final class UpdateAzureOpenAiCredentialDto { + private final UpdateAzureOpenAiCredentialDtoRegion region; + + private final List models; + + private final String openAiKey; + + private final String openAiEndpoint; + + private final Map additionalProperties; + + private UpdateAzureOpenAiCredentialDto( + UpdateAzureOpenAiCredentialDtoRegion region, + List models, + String openAiKey, + String openAiEndpoint, + Map additionalProperties) { + this.region = region; + this.models = models; + this.openAiKey = openAiKey; + this.openAiEndpoint = openAiEndpoint; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "azure-openai"; + } + + @JsonProperty("region") + public UpdateAzureOpenAiCredentialDtoRegion getRegion() { + return region; + } + + @JsonProperty("models") + public List getModels() { + return models; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("openAIKey") + public String getOpenAiKey() { + return openAiKey; + } + + @JsonProperty("openAIEndpoint") + public String getOpenAiEndpoint() { + return openAiEndpoint; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateAzureOpenAiCredentialDto && equalTo((UpdateAzureOpenAiCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateAzureOpenAiCredentialDto other) { + return region.equals(other.region) + && models.equals(other.models) + && openAiKey.equals(other.openAiKey) + && openAiEndpoint.equals(other.openAiEndpoint); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.region, this.models, this.openAiKey, this.openAiEndpoint); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RegionStage builder() { + return new Builder(); + } + + public interface RegionStage { + OpenAiKeyStage region(@NotNull UpdateAzureOpenAiCredentialDtoRegion region); + + Builder from(UpdateAzureOpenAiCredentialDto other); + } + + public interface OpenAiKeyStage { + OpenAiEndpointStage openAiKey(@NotNull String openAiKey); + } + + public interface OpenAiEndpointStage { + _FinalStage openAiEndpoint(@NotNull String openAiEndpoint); + } + + public interface _FinalStage { + UpdateAzureOpenAiCredentialDto build(); + + _FinalStage models(List models); + + _FinalStage addModels(UpdateAzureOpenAiCredentialDtoModelsItem models); + + _FinalStage addAllModels(List models); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RegionStage, OpenAiKeyStage, OpenAiEndpointStage, _FinalStage { + private UpdateAzureOpenAiCredentialDtoRegion region; + + private String openAiKey; + + private String openAiEndpoint; + + private List models = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateAzureOpenAiCredentialDto other) { + region(other.getRegion()); + models(other.getModels()); + openAiKey(other.getOpenAiKey()); + openAiEndpoint(other.getOpenAiEndpoint()); + return this; + } + + @java.lang.Override + @JsonSetter("region") + public OpenAiKeyStage region(@NotNull UpdateAzureOpenAiCredentialDtoRegion region) { + this.region = Objects.requireNonNull(region, "region must not be null"); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("openAIKey") + public OpenAiEndpointStage openAiKey(@NotNull String openAiKey) { + this.openAiKey = Objects.requireNonNull(openAiKey, "openAiKey must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("openAIEndpoint") + public _FinalStage openAiEndpoint(@NotNull String openAiEndpoint) { + this.openAiEndpoint = Objects.requireNonNull(openAiEndpoint, "openAiEndpoint must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllModels(List models) { + this.models.addAll(models); + return this; + } + + @java.lang.Override + public _FinalStage addModels(UpdateAzureOpenAiCredentialDtoModelsItem models) { + this.models.add(models); + return this; + } + + @java.lang.Override + @JsonSetter(value = "models", nulls = Nulls.SKIP) + public _FinalStage models(List models) { + this.models.clear(); + this.models.addAll(models); + return this; + } + + @java.lang.Override + public UpdateAzureOpenAiCredentialDto build() { + return new UpdateAzureOpenAiCredentialDto(region, models, openAiKey, openAiEndpoint, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateAzureOpenAiCredentialDtoModelsItem.java b/src/main/java/com/vapi/api/types/UpdateAzureOpenAiCredentialDtoModelsItem.java new file mode 100644 index 0000000..2247d8a --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateAzureOpenAiCredentialDtoModelsItem.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum UpdateAzureOpenAiCredentialDtoModelsItem { + GPT_4_O_MINI_20240718("gpt-4o-mini-2024-07-18"), + + GPT_4_O_20240513("gpt-4o-2024-05-13"), + + GPT_4_TURBO_20240409("gpt-4-turbo-2024-04-09"), + + GPT_40125_PREVIEW("gpt-4-0125-preview"), + + GPT_41106_PREVIEW("gpt-4-1106-preview"), + + GPT_40613("gpt-4-0613"), + + GPT_35_TURBO_0125("gpt-35-turbo-0125"), + + GPT_35_TURBO_1106("gpt-35-turbo-1106"); + + private final String value; + + UpdateAzureOpenAiCredentialDtoModelsItem(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateAzureOpenAiCredentialDtoRegion.java b/src/main/java/com/vapi/api/types/UpdateAzureOpenAiCredentialDtoRegion.java new file mode 100644 index 0000000..39f5f11 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateAzureOpenAiCredentialDtoRegion.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum UpdateAzureOpenAiCredentialDtoRegion { + AUSTRALIA("australia"), + + CANADA("canada"), + + EASTUS_2("eastus2"), + + EASTUS("eastus"), + + FRANCE("france"), + + INDIA("india"), + + JAPAN("japan"), + + NORTHCENTRALUS("northcentralus"), + + NORWAY("norway"), + + SOUTHCENTRALUS("southcentralus"), + + SWEDEN("sweden"), + + SWITZERLAND("switzerland"), + + UK("uk"), + + WESTUS("westus"), + + WESTUS_3("westus3"); + + private final String value; + + UpdateAzureOpenAiCredentialDtoRegion(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateByoSipTrunkCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateByoSipTrunkCredentialDto.java new file mode 100644 index 0000000..6bce23c --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateByoSipTrunkCredentialDto.java @@ -0,0 +1,262 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateByoSipTrunkCredentialDto.Builder.class) +public final class UpdateByoSipTrunkCredentialDto { + private final Optional provider; + + private final List gateways; + + private final Optional name; + + private final Optional outboundAuthenticationPlan; + + private final Optional outboundLeadingPlusEnabled; + + private final Optional sbcConfiguration; + + private final Map additionalProperties; + + private UpdateByoSipTrunkCredentialDto( + Optional provider, + List gateways, + Optional name, + Optional outboundAuthenticationPlan, + Optional outboundLeadingPlusEnabled, + Optional sbcConfiguration, + Map additionalProperties) { + this.provider = provider; + this.gateways = gateways; + this.name = name; + this.outboundAuthenticationPlan = outboundAuthenticationPlan; + this.outboundLeadingPlusEnabled = outboundLeadingPlusEnabled; + this.sbcConfiguration = sbcConfiguration; + this.additionalProperties = additionalProperties; + } + + /** + * @return This can be used to bring your own SIP trunks or to connect to a Carrier. + */ + @JsonProperty("provider") + public Optional getProvider() { + return provider; + } + + /** + * @return This is the list of SIP trunk's gateways. + */ + @JsonProperty("gateways") + public List getGateways() { + return gateways; + } + + /** + * @return This is the name of the SIP trunk. This is just for your reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This can be used to configure the outbound authentication if required by the SIP trunk. + */ + @JsonProperty("outboundAuthenticationPlan") + public Optional getOutboundAuthenticationPlan() { + return outboundAuthenticationPlan; + } + + /** + * @return This ensures the outbound origination attempts have a leading plus. Defaults to false to match conventional telecom behavior. + *

Usage:

+ *
    + *
  • Vonage/Twilio requires leading plus for all outbound calls. Set this to true.
  • + *
+ *

@default false

+ */ + @JsonProperty("outboundLeadingPlusEnabled") + public Optional getOutboundLeadingPlusEnabled() { + return outboundLeadingPlusEnabled; + } + + /** + * @return This is an advanced configuration for enterprise deployments. This uses the onprem SBC to trunk into the SIP trunk's gateways, rather than the managed SBC provided by Vapi. + */ + @JsonProperty("sbcConfiguration") + public Optional getSbcConfiguration() { + return sbcConfiguration; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateByoSipTrunkCredentialDto && equalTo((UpdateByoSipTrunkCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateByoSipTrunkCredentialDto other) { + return provider.equals(other.provider) + && gateways.equals(other.gateways) + && name.equals(other.name) + && outboundAuthenticationPlan.equals(other.outboundAuthenticationPlan) + && outboundLeadingPlusEnabled.equals(other.outboundLeadingPlusEnabled) + && sbcConfiguration.equals(other.sbcConfiguration); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.provider, + this.gateways, + this.name, + this.outboundAuthenticationPlan, + this.outboundLeadingPlusEnabled, + this.sbcConfiguration); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional provider = Optional.empty(); + + private List gateways = new ArrayList<>(); + + private Optional name = Optional.empty(); + + private Optional outboundAuthenticationPlan = Optional.empty(); + + private Optional outboundLeadingPlusEnabled = Optional.empty(); + + private Optional sbcConfiguration = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateByoSipTrunkCredentialDto other) { + provider(other.getProvider()); + gateways(other.getGateways()); + name(other.getName()); + outboundAuthenticationPlan(other.getOutboundAuthenticationPlan()); + outboundLeadingPlusEnabled(other.getOutboundLeadingPlusEnabled()); + sbcConfiguration(other.getSbcConfiguration()); + return this; + } + + @JsonSetter(value = "provider", nulls = Nulls.SKIP) + public Builder provider(Optional provider) { + this.provider = provider; + return this; + } + + public Builder provider(String provider) { + this.provider = Optional.ofNullable(provider); + return this; + } + + @JsonSetter(value = "gateways", nulls = Nulls.SKIP) + public Builder gateways(List gateways) { + this.gateways.clear(); + this.gateways.addAll(gateways); + return this; + } + + public Builder addGateways(SipTrunkGateway gateways) { + this.gateways.add(gateways); + return this; + } + + public Builder addAllGateways(List gateways) { + this.gateways.addAll(gateways); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "outboundAuthenticationPlan", nulls = Nulls.SKIP) + public Builder outboundAuthenticationPlan( + Optional outboundAuthenticationPlan) { + this.outboundAuthenticationPlan = outboundAuthenticationPlan; + return this; + } + + public Builder outboundAuthenticationPlan(SipTrunkOutboundAuthenticationPlan outboundAuthenticationPlan) { + this.outboundAuthenticationPlan = Optional.ofNullable(outboundAuthenticationPlan); + return this; + } + + @JsonSetter(value = "outboundLeadingPlusEnabled", nulls = Nulls.SKIP) + public Builder outboundLeadingPlusEnabled(Optional outboundLeadingPlusEnabled) { + this.outboundLeadingPlusEnabled = outboundLeadingPlusEnabled; + return this; + } + + public Builder outboundLeadingPlusEnabled(Boolean outboundLeadingPlusEnabled) { + this.outboundLeadingPlusEnabled = Optional.ofNullable(outboundLeadingPlusEnabled); + return this; + } + + @JsonSetter(value = "sbcConfiguration", nulls = Nulls.SKIP) + public Builder sbcConfiguration(Optional sbcConfiguration) { + this.sbcConfiguration = sbcConfiguration; + return this; + } + + public Builder sbcConfiguration(SbcConfiguration sbcConfiguration) { + this.sbcConfiguration = Optional.ofNullable(sbcConfiguration); + return this; + } + + public UpdateByoSipTrunkCredentialDto build() { + return new UpdateByoSipTrunkCredentialDto( + provider, + gateways, + name, + outboundAuthenticationPlan, + outboundLeadingPlusEnabled, + sbcConfiguration, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateCartesiaCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateCartesiaCredentialDto.java new file mode 100644 index 0000000..ca037ba --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateCartesiaCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCartesiaCredentialDto.Builder.class) +public final class UpdateCartesiaCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdateCartesiaCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "cartesia"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCartesiaCredentialDto && equalTo((UpdateCartesiaCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCartesiaCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateCartesiaCredentialDto other); + } + + public interface _FinalStage { + UpdateCartesiaCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCartesiaCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateCartesiaCredentialDto build() { + return new UpdateCartesiaCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateCustomLlmCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateCustomLlmCredentialDto.java new file mode 100644 index 0000000..53f795b --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateCustomLlmCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateCustomLlmCredentialDto.Builder.class) +public final class UpdateCustomLlmCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdateCustomLlmCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "custom-llm"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateCustomLlmCredentialDto && equalTo((UpdateCustomLlmCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateCustomLlmCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateCustomLlmCredentialDto other); + } + + public interface _FinalStage { + UpdateCustomLlmCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateCustomLlmCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateCustomLlmCredentialDto build() { + return new UpdateCustomLlmCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateDeepInfraCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateDeepInfraCredentialDto.java new file mode 100644 index 0000000..e74c125 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateDeepInfraCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateDeepInfraCredentialDto.Builder.class) +public final class UpdateDeepInfraCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdateDeepInfraCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "deepinfra"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateDeepInfraCredentialDto && equalTo((UpdateDeepInfraCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateDeepInfraCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateDeepInfraCredentialDto other); + } + + public interface _FinalStage { + UpdateDeepInfraCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateDeepInfraCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateDeepInfraCredentialDto build() { + return new UpdateDeepInfraCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateDeepgramCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateDeepgramCredentialDto.java new file mode 100644 index 0000000..e453302 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateDeepgramCredentialDto.java @@ -0,0 +1,152 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateDeepgramCredentialDto.Builder.class) +public final class UpdateDeepgramCredentialDto { + private final String apiKey; + + private final Optional apiUrl; + + private final Map additionalProperties; + + private UpdateDeepgramCredentialDto( + String apiKey, Optional apiUrl, Map additionalProperties) { + this.apiKey = apiKey; + this.apiUrl = apiUrl; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "deepgram"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return This can be used to point to an onprem Deepgram instance. Defaults to api.deepgram.com. + */ + @JsonProperty("apiUrl") + public Optional getApiUrl() { + return apiUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateDeepgramCredentialDto && equalTo((UpdateDeepgramCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateDeepgramCredentialDto other) { + return apiKey.equals(other.apiKey) && apiUrl.equals(other.apiUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.apiUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateDeepgramCredentialDto other); + } + + public interface _FinalStage { + UpdateDeepgramCredentialDto build(); + + _FinalStage apiUrl(Optional apiUrl); + + _FinalStage apiUrl(String apiUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + private Optional apiUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateDeepgramCredentialDto other) { + apiKey(other.getApiKey()); + apiUrl(other.getApiUrl()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + /** + *

This can be used to point to an onprem Deepgram instance. Defaults to api.deepgram.com.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage apiUrl(String apiUrl) { + this.apiUrl = Optional.ofNullable(apiUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "apiUrl", nulls = Nulls.SKIP) + public _FinalStage apiUrl(Optional apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + @java.lang.Override + public UpdateDeepgramCredentialDto build() { + return new UpdateDeepgramCredentialDto(apiKey, apiUrl, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateElevenLabsCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateElevenLabsCredentialDto.java new file mode 100644 index 0000000..dc2d2f7 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateElevenLabsCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateElevenLabsCredentialDto.Builder.class) +public final class UpdateElevenLabsCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdateElevenLabsCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "11labs"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateElevenLabsCredentialDto && equalTo((UpdateElevenLabsCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateElevenLabsCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateElevenLabsCredentialDto other); + } + + public interface _FinalStage { + UpdateElevenLabsCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateElevenLabsCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateElevenLabsCredentialDto build() { + return new UpdateElevenLabsCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateGcpCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateGcpCredentialDto.java new file mode 100644 index 0000000..9398505 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateGcpCredentialDto.java @@ -0,0 +1,192 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateGcpCredentialDto.Builder.class) +public final class UpdateGcpCredentialDto { + private final Optional name; + + private final GcpKey gcpKey; + + private final Optional bucketPlan; + + private final Map additionalProperties; + + private UpdateGcpCredentialDto( + Optional name, + GcpKey gcpKey, + Optional bucketPlan, + Map additionalProperties) { + this.name = name; + this.gcpKey = gcpKey; + this.bucketPlan = bucketPlan; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "gcp"; + } + + /** + * @return This is the name of the GCP credential. This is just for your reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the GCP key. This is the JSON that can be generated in the Google Cloud Console at https://console.cloud.google.com/iam-admin/serviceaccounts/details/<service-account-id>/keys. + *

The schema is identical to the JSON that GCP outputs.

+ */ + @JsonProperty("gcpKey") + public GcpKey getGcpKey() { + return gcpKey; + } + + /** + * @return This is the bucket plan that can be provided to store call artifacts in GCP. + */ + @JsonProperty("bucketPlan") + public Optional getBucketPlan() { + return bucketPlan; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateGcpCredentialDto && equalTo((UpdateGcpCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateGcpCredentialDto other) { + return name.equals(other.name) && gcpKey.equals(other.gcpKey) && bucketPlan.equals(other.bucketPlan); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.name, this.gcpKey, this.bucketPlan); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static GcpKeyStage builder() { + return new Builder(); + } + + public interface GcpKeyStage { + _FinalStage gcpKey(@NotNull GcpKey gcpKey); + + Builder from(UpdateGcpCredentialDto other); + } + + public interface _FinalStage { + UpdateGcpCredentialDto build(); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage bucketPlan(Optional bucketPlan); + + _FinalStage bucketPlan(BucketPlan bucketPlan); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements GcpKeyStage, _FinalStage { + private GcpKey gcpKey; + + private Optional bucketPlan = Optional.empty(); + + private Optional name = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateGcpCredentialDto other) { + name(other.getName()); + gcpKey(other.getGcpKey()); + bucketPlan(other.getBucketPlan()); + return this; + } + + /** + *

This is the GCP key. This is the JSON that can be generated in the Google Cloud Console at https://console.cloud.google.com/iam-admin/serviceaccounts/details/<service-account-id>/keys.

+ *

The schema is identical to the JSON that GCP outputs.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("gcpKey") + public _FinalStage gcpKey(@NotNull GcpKey gcpKey) { + this.gcpKey = Objects.requireNonNull(gcpKey, "gcpKey must not be null"); + return this; + } + + /** + *

This is the bucket plan that can be provided to store call artifacts in GCP.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage bucketPlan(BucketPlan bucketPlan) { + this.bucketPlan = Optional.ofNullable(bucketPlan); + return this; + } + + @java.lang.Override + @JsonSetter(value = "bucketPlan", nulls = Nulls.SKIP) + public _FinalStage bucketPlan(Optional bucketPlan) { + this.bucketPlan = bucketPlan; + return this; + } + + /** + *

This is the name of the GCP credential. This is just for your reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + @java.lang.Override + public UpdateGcpCredentialDto build() { + return new UpdateGcpCredentialDto(name, gcpKey, bucketPlan, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateGladiaCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateGladiaCredentialDto.java new file mode 100644 index 0000000..dbc1c35 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateGladiaCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateGladiaCredentialDto.Builder.class) +public final class UpdateGladiaCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdateGladiaCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "gladia"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateGladiaCredentialDto && equalTo((UpdateGladiaCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateGladiaCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateGladiaCredentialDto other); + } + + public interface _FinalStage { + UpdateGladiaCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateGladiaCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateGladiaCredentialDto build() { + return new UpdateGladiaCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateGoHighLevelCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateGoHighLevelCredentialDto.java new file mode 100644 index 0000000..0d9fa3e --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateGoHighLevelCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateGoHighLevelCredentialDto.Builder.class) +public final class UpdateGoHighLevelCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdateGoHighLevelCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "gohighlevel"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateGoHighLevelCredentialDto && equalTo((UpdateGoHighLevelCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateGoHighLevelCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateGoHighLevelCredentialDto other); + } + + public interface _FinalStage { + UpdateGoHighLevelCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateGoHighLevelCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateGoHighLevelCredentialDto build() { + return new UpdateGoHighLevelCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateGroqCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateGroqCredentialDto.java new file mode 100644 index 0000000..172395b --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateGroqCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateGroqCredentialDto.Builder.class) +public final class UpdateGroqCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdateGroqCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "groq"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateGroqCredentialDto && equalTo((UpdateGroqCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateGroqCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateGroqCredentialDto other); + } + + public interface _FinalStage { + UpdateGroqCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateGroqCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateGroqCredentialDto build() { + return new UpdateGroqCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateLmntCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateLmntCredentialDto.java new file mode 100644 index 0000000..68d10ba --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateLmntCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateLmntCredentialDto.Builder.class) +public final class UpdateLmntCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdateLmntCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "lmnt"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateLmntCredentialDto && equalTo((UpdateLmntCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateLmntCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateLmntCredentialDto other); + } + + public interface _FinalStage { + UpdateLmntCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateLmntCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateLmntCredentialDto build() { + return new UpdateLmntCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateMakeCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateMakeCredentialDto.java new file mode 100644 index 0000000..5d36251 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateMakeCredentialDto.java @@ -0,0 +1,173 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateMakeCredentialDto.Builder.class) +public final class UpdateMakeCredentialDto { + private final String teamId; + + private final String region; + + private final String apiKey; + + private final Map additionalProperties; + + private UpdateMakeCredentialDto( + String teamId, String region, String apiKey, Map additionalProperties) { + this.teamId = teamId; + this.region = region; + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "make"; + } + + /** + * @return Team ID + */ + @JsonProperty("teamId") + public String getTeamId() { + return teamId; + } + + /** + * @return Region of your application. For example: eu1, eu2, us1, us2 + */ + @JsonProperty("region") + public String getRegion() { + return region; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateMakeCredentialDto && equalTo((UpdateMakeCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateMakeCredentialDto other) { + return teamId.equals(other.teamId) && region.equals(other.region) && apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.teamId, this.region, this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static TeamIdStage builder() { + return new Builder(); + } + + public interface TeamIdStage { + RegionStage teamId(@NotNull String teamId); + + Builder from(UpdateMakeCredentialDto other); + } + + public interface RegionStage { + ApiKeyStage region(@NotNull String region); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + } + + public interface _FinalStage { + UpdateMakeCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TeamIdStage, RegionStage, ApiKeyStage, _FinalStage { + private String teamId; + + private String region; + + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateMakeCredentialDto other) { + teamId(other.getTeamId()); + region(other.getRegion()); + apiKey(other.getApiKey()); + return this; + } + + /** + *

Team ID

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("teamId") + public RegionStage teamId(@NotNull String teamId) { + this.teamId = Objects.requireNonNull(teamId, "teamId must not be null"); + return this; + } + + /** + *

Region of your application. For example: eu1, eu2, us1, us2

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("region") + public ApiKeyStage region(@NotNull String region) { + this.region = Objects.requireNonNull(region, "region must not be null"); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateMakeCredentialDto build() { + return new UpdateMakeCredentialDto(teamId, region, apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateOpenAiCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateOpenAiCredentialDto.java new file mode 100644 index 0000000..373073a --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateOpenAiCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateOpenAiCredentialDto.Builder.class) +public final class UpdateOpenAiCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdateOpenAiCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "openai"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateOpenAiCredentialDto && equalTo((UpdateOpenAiCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateOpenAiCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateOpenAiCredentialDto other); + } + + public interface _FinalStage { + UpdateOpenAiCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateOpenAiCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateOpenAiCredentialDto build() { + return new UpdateOpenAiCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateOpenRouterCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateOpenRouterCredentialDto.java new file mode 100644 index 0000000..8df486f --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateOpenRouterCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateOpenRouterCredentialDto.Builder.class) +public final class UpdateOpenRouterCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdateOpenRouterCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "openrouter"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateOpenRouterCredentialDto && equalTo((UpdateOpenRouterCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateOpenRouterCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateOpenRouterCredentialDto other); + } + + public interface _FinalStage { + UpdateOpenRouterCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateOpenRouterCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateOpenRouterCredentialDto build() { + return new UpdateOpenRouterCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateOrgDto.java b/src/main/java/com/vapi/api/types/UpdateOrgDto.java new file mode 100644 index 0000000..0e17d5f --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateOrgDto.java @@ -0,0 +1,251 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateOrgDto.Builder.class) +public final class UpdateOrgDto { + private final Optional hipaaEnabled; + + private final Optional name; + + private final Optional billingLimit; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final Optional concurrencyLimit; + + private final Map additionalProperties; + + private UpdateOrgDto( + Optional hipaaEnabled, + Optional name, + Optional billingLimit, + Optional serverUrl, + Optional serverUrlSecret, + Optional concurrencyLimit, + Map additionalProperties) { + this.hipaaEnabled = hipaaEnabled; + this.name = name; + this.billingLimit = billingLimit; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.concurrencyLimit = concurrencyLimit; + this.additionalProperties = additionalProperties; + } + + /** + * @return When this is enabled, no logs, recordings, or transcriptions will be stored. At the end of the call, you will still receive an end-of-call-report message to store on your server. Defaults to false. + * When HIPAA is enabled, only OpenAI/Custom LLM or Azure Providers will be available for LLM and Voice respectively. + * This is due to the compliance requirements of HIPAA. Other providers may not meet these requirements. + */ + @JsonProperty("hipaaEnabled") + public Optional getHipaaEnabled() { + return hipaaEnabled; + } + + /** + * @return This is the name of the org. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the monthly billing limit for the org. To go beyond $1000/mo, please contact us at support@vapi.ai. + */ + @JsonProperty("billingLimit") + public Optional getBillingLimit() { + return billingLimit; + } + + /** + * @return This is the URL Vapi will communicate with via HTTP GET and POST Requests. This is used for retrieving context, function calling, and end-of-call reports. + *

All requests will be sent with the call object among other things relevant to that message. You can find more details in the Server URL documentation.

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret you can set that Vapi will send with every request to your server. Will be sent as a header called x-vapi-secret. + */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + /** + * @return This is the concurrency limit for the org. This is the maximum number of calls that can be active at any given time. To go beyond 10, please contact us at support@vapi.ai. + */ + @JsonProperty("concurrencyLimit") + public Optional getConcurrencyLimit() { + return concurrencyLimit; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateOrgDto && equalTo((UpdateOrgDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateOrgDto other) { + return hipaaEnabled.equals(other.hipaaEnabled) + && name.equals(other.name) + && billingLimit.equals(other.billingLimit) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret) + && concurrencyLimit.equals(other.concurrencyLimit); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.hipaaEnabled, + this.name, + this.billingLimit, + this.serverUrl, + this.serverUrlSecret, + this.concurrencyLimit); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional hipaaEnabled = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional billingLimit = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional serverUrlSecret = Optional.empty(); + + private Optional concurrencyLimit = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateOrgDto other) { + hipaaEnabled(other.getHipaaEnabled()); + name(other.getName()); + billingLimit(other.getBillingLimit()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + concurrencyLimit(other.getConcurrencyLimit()); + return this; + } + + @JsonSetter(value = "hipaaEnabled", nulls = Nulls.SKIP) + public Builder hipaaEnabled(Optional hipaaEnabled) { + this.hipaaEnabled = hipaaEnabled; + return this; + } + + public Builder hipaaEnabled(Boolean hipaaEnabled) { + this.hipaaEnabled = Optional.ofNullable(hipaaEnabled); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "billingLimit", nulls = Nulls.SKIP) + public Builder billingLimit(Optional billingLimit) { + this.billingLimit = billingLimit; + return this; + } + + public Builder billingLimit(Double billingLimit) { + this.billingLimit = Optional.ofNullable(billingLimit); + return this; + } + + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public Builder serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + public Builder serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public Builder serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + public Builder serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @JsonSetter(value = "concurrencyLimit", nulls = Nulls.SKIP) + public Builder concurrencyLimit(Optional concurrencyLimit) { + this.concurrencyLimit = concurrencyLimit; + return this; + } + + public Builder concurrencyLimit(Double concurrencyLimit) { + this.concurrencyLimit = Optional.ofNullable(concurrencyLimit); + return this; + } + + public UpdateOrgDto build() { + return new UpdateOrgDto( + hipaaEnabled, + name, + billingLimit, + serverUrl, + serverUrlSecret, + concurrencyLimit, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdatePerplexityAiCredentialDto.java b/src/main/java/com/vapi/api/types/UpdatePerplexityAiCredentialDto.java new file mode 100644 index 0000000..af76d3a --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdatePerplexityAiCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePerplexityAiCredentialDto.Builder.class) +public final class UpdatePerplexityAiCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdatePerplexityAiCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "perplexity-ai"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePerplexityAiCredentialDto && equalTo((UpdatePerplexityAiCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePerplexityAiCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdatePerplexityAiCredentialDto other); + } + + public interface _FinalStage { + UpdatePerplexityAiCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdatePerplexityAiCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdatePerplexityAiCredentialDto build() { + return new UpdatePerplexityAiCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdatePlayHtCredentialDto.java b/src/main/java/com/vapi/api/types/UpdatePlayHtCredentialDto.java new file mode 100644 index 0000000..fb2d2fb --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdatePlayHtCredentialDto.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdatePlayHtCredentialDto.Builder.class) +public final class UpdatePlayHtCredentialDto { + private final String apiKey; + + private final String userId; + + private final Map additionalProperties; + + private UpdatePlayHtCredentialDto(String apiKey, String userId, Map additionalProperties) { + this.apiKey = apiKey; + this.userId = userId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "playht"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @JsonProperty("userId") + public String getUserId() { + return userId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdatePlayHtCredentialDto && equalTo((UpdatePlayHtCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdatePlayHtCredentialDto other) { + return apiKey.equals(other.apiKey) && userId.equals(other.userId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey, this.userId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + UserIdStage apiKey(@NotNull String apiKey); + + Builder from(UpdatePlayHtCredentialDto other); + } + + public interface UserIdStage { + _FinalStage userId(@NotNull String userId); + } + + public interface _FinalStage { + UpdatePlayHtCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, UserIdStage, _FinalStage { + private String apiKey; + + private String userId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdatePlayHtCredentialDto other) { + apiKey(other.getApiKey()); + userId(other.getUserId()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public UserIdStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("userId") + public _FinalStage userId(@NotNull String userId) { + this.userId = Objects.requireNonNull(userId, "userId must not be null"); + return this; + } + + @java.lang.Override + public UpdatePlayHtCredentialDto build() { + return new UpdatePlayHtCredentialDto(apiKey, userId, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateRimeAiCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateRimeAiCredentialDto.java new file mode 100644 index 0000000..cd4b698 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateRimeAiCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateRimeAiCredentialDto.Builder.class) +public final class UpdateRimeAiCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdateRimeAiCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "rime-ai"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateRimeAiCredentialDto && equalTo((UpdateRimeAiCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateRimeAiCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateRimeAiCredentialDto other); + } + + public interface _FinalStage { + UpdateRimeAiCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateRimeAiCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateRimeAiCredentialDto build() { + return new UpdateRimeAiCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateRunpodCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateRunpodCredentialDto.java new file mode 100644 index 0000000..2f0c2f7 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateRunpodCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateRunpodCredentialDto.Builder.class) +public final class UpdateRunpodCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdateRunpodCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "runpod"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateRunpodCredentialDto && equalTo((UpdateRunpodCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateRunpodCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateRunpodCredentialDto other); + } + + public interface _FinalStage { + UpdateRunpodCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateRunpodCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateRunpodCredentialDto build() { + return new UpdateRunpodCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateS3CredentialDto.java b/src/main/java/com/vapi/api/types/UpdateS3CredentialDto.java new file mode 100644 index 0000000..1f94dc9 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateS3CredentialDto.java @@ -0,0 +1,251 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateS3CredentialDto.Builder.class) +public final class UpdateS3CredentialDto { + private final String awsAccessKeyId; + + private final String awsSecretAccessKey; + + private final String region; + + private final String s3BucketName; + + private final String s3PathPrefix; + + private final Map additionalProperties; + + private UpdateS3CredentialDto( + String awsAccessKeyId, + String awsSecretAccessKey, + String region, + String s3BucketName, + String s3PathPrefix, + Map additionalProperties) { + this.awsAccessKeyId = awsAccessKeyId; + this.awsSecretAccessKey = awsSecretAccessKey; + this.region = region; + this.s3BucketName = s3BucketName; + this.s3PathPrefix = s3PathPrefix; + this.additionalProperties = additionalProperties; + } + + /** + * @return Credential provider. Only allowed value is s3 + */ + @JsonProperty("provider") + public String getProvider() { + return "s3"; + } + + /** + * @return AWS access key ID. + */ + @JsonProperty("awsAccessKeyId") + public String getAwsAccessKeyId() { + return awsAccessKeyId; + } + + /** + * @return AWS access key secret. This is not returned in the API. + */ + @JsonProperty("awsSecretAccessKey") + public String getAwsSecretAccessKey() { + return awsSecretAccessKey; + } + + /** + * @return AWS region in which the S3 bucket is located. + */ + @JsonProperty("region") + public String getRegion() { + return region; + } + + /** + * @return AWS S3 bucket name. + */ + @JsonProperty("s3BucketName") + public String getS3BucketName() { + return s3BucketName; + } + + /** + * @return The path prefix for the uploaded recording. Ex. "recordings/" + */ + @JsonProperty("s3PathPrefix") + public String getS3PathPrefix() { + return s3PathPrefix; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateS3CredentialDto && equalTo((UpdateS3CredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateS3CredentialDto other) { + return awsAccessKeyId.equals(other.awsAccessKeyId) + && awsSecretAccessKey.equals(other.awsSecretAccessKey) + && region.equals(other.region) + && s3BucketName.equals(other.s3BucketName) + && s3PathPrefix.equals(other.s3PathPrefix); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.awsAccessKeyId, this.awsSecretAccessKey, this.region, this.s3BucketName, this.s3PathPrefix); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AwsAccessKeyIdStage builder() { + return new Builder(); + } + + public interface AwsAccessKeyIdStage { + AwsSecretAccessKeyStage awsAccessKeyId(@NotNull String awsAccessKeyId); + + Builder from(UpdateS3CredentialDto other); + } + + public interface AwsSecretAccessKeyStage { + RegionStage awsSecretAccessKey(@NotNull String awsSecretAccessKey); + } + + public interface RegionStage { + S3BucketNameStage region(@NotNull String region); + } + + public interface S3BucketNameStage { + S3PathPrefixStage s3BucketName(@NotNull String s3BucketName); + } + + public interface S3PathPrefixStage { + _FinalStage s3PathPrefix(@NotNull String s3PathPrefix); + } + + public interface _FinalStage { + UpdateS3CredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements AwsAccessKeyIdStage, + AwsSecretAccessKeyStage, + RegionStage, + S3BucketNameStage, + S3PathPrefixStage, + _FinalStage { + private String awsAccessKeyId; + + private String awsSecretAccessKey; + + private String region; + + private String s3BucketName; + + private String s3PathPrefix; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateS3CredentialDto other) { + awsAccessKeyId(other.getAwsAccessKeyId()); + awsSecretAccessKey(other.getAwsSecretAccessKey()); + region(other.getRegion()); + s3BucketName(other.getS3BucketName()); + s3PathPrefix(other.getS3PathPrefix()); + return this; + } + + /** + *

AWS access key ID.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("awsAccessKeyId") + public AwsSecretAccessKeyStage awsAccessKeyId(@NotNull String awsAccessKeyId) { + this.awsAccessKeyId = Objects.requireNonNull(awsAccessKeyId, "awsAccessKeyId must not be null"); + return this; + } + + /** + *

AWS access key secret. This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("awsSecretAccessKey") + public RegionStage awsSecretAccessKey(@NotNull String awsSecretAccessKey) { + this.awsSecretAccessKey = Objects.requireNonNull(awsSecretAccessKey, "awsSecretAccessKey must not be null"); + return this; + } + + /** + *

AWS region in which the S3 bucket is located.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("region") + public S3BucketNameStage region(@NotNull String region) { + this.region = Objects.requireNonNull(region, "region must not be null"); + return this; + } + + /** + *

AWS S3 bucket name.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("s3BucketName") + public S3PathPrefixStage s3BucketName(@NotNull String s3BucketName) { + this.s3BucketName = Objects.requireNonNull(s3BucketName, "s3BucketName must not be null"); + return this; + } + + /** + *

The path prefix for the uploaded recording. Ex. "recordings/"

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("s3PathPrefix") + public _FinalStage s3PathPrefix(@NotNull String s3PathPrefix) { + this.s3PathPrefix = Objects.requireNonNull(s3PathPrefix, "s3PathPrefix must not be null"); + return this; + } + + @java.lang.Override + public UpdateS3CredentialDto build() { + return new UpdateS3CredentialDto( + awsAccessKeyId, awsSecretAccessKey, region, s3BucketName, s3PathPrefix, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateTogetherAiCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateTogetherAiCredentialDto.java new file mode 100644 index 0000000..42e0637 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateTogetherAiCredentialDto.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateTogetherAiCredentialDto.Builder.class) +public final class UpdateTogetherAiCredentialDto { + private final String apiKey; + + private final Map additionalProperties; + + private UpdateTogetherAiCredentialDto(String apiKey, Map additionalProperties) { + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "together-ai"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateTogetherAiCredentialDto && equalTo((UpdateTogetherAiCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateTogetherAiCredentialDto other) { + return apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + + Builder from(UpdateTogetherAiCredentialDto other); + } + + public interface _FinalStage { + UpdateTogetherAiCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiKeyStage, _FinalStage { + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateTogetherAiCredentialDto other) { + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateTogetherAiCredentialDto build() { + return new UpdateTogetherAiCredentialDto(apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateToolTemplateDto.java b/src/main/java/com/vapi/api/types/UpdateToolTemplateDto.java new file mode 100644 index 0000000..3e4af22 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateToolTemplateDto.java @@ -0,0 +1,227 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateToolTemplateDto.Builder.class) +public final class UpdateToolTemplateDto { + private final Optional details; + + private final Optional providerDetails; + + private final Optional metadata; + + private final Optional visibility; + + private final Optional name; + + private final Optional provider; + + private final Map additionalProperties; + + private UpdateToolTemplateDto( + Optional details, + Optional providerDetails, + Optional metadata, + Optional visibility, + Optional name, + Optional provider, + Map additionalProperties) { + this.details = details; + this.providerDetails = providerDetails; + this.metadata = metadata; + this.visibility = visibility; + this.name = name; + this.provider = provider; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("details") + public Optional getDetails() { + return details; + } + + @JsonProperty("providerDetails") + public Optional getProviderDetails() { + return providerDetails; + } + + @JsonProperty("metadata") + public Optional getMetadata() { + return metadata; + } + + @JsonProperty("visibility") + public Optional getVisibility() { + return visibility; + } + + @JsonProperty("type") + public String getType() { + return "tool"; + } + + /** + * @return The name of the template. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("provider") + public Optional getProvider() { + return provider; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateToolTemplateDto && equalTo((UpdateToolTemplateDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateToolTemplateDto other) { + return details.equals(other.details) + && providerDetails.equals(other.providerDetails) + && metadata.equals(other.metadata) + && visibility.equals(other.visibility) + && name.equals(other.name) + && provider.equals(other.provider); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.details, this.providerDetails, this.metadata, this.visibility, this.name, this.provider); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional details = Optional.empty(); + + private Optional providerDetails = Optional.empty(); + + private Optional metadata = Optional.empty(); + + private Optional visibility = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional provider = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(UpdateToolTemplateDto other) { + details(other.getDetails()); + providerDetails(other.getProviderDetails()); + metadata(other.getMetadata()); + visibility(other.getVisibility()); + name(other.getName()); + provider(other.getProvider()); + return this; + } + + @JsonSetter(value = "details", nulls = Nulls.SKIP) + public Builder details(Optional details) { + this.details = details; + return this; + } + + public Builder details(UpdateToolTemplateDtoDetails details) { + this.details = Optional.ofNullable(details); + return this; + } + + @JsonSetter(value = "providerDetails", nulls = Nulls.SKIP) + public Builder providerDetails(Optional providerDetails) { + this.providerDetails = providerDetails; + return this; + } + + public Builder providerDetails(UpdateToolTemplateDtoProviderDetails providerDetails) { + this.providerDetails = Optional.ofNullable(providerDetails); + return this; + } + + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public Builder metadata(Optional metadata) { + this.metadata = metadata; + return this; + } + + public Builder metadata(ToolTemplateMetadata metadata) { + this.metadata = Optional.ofNullable(metadata); + return this; + } + + @JsonSetter(value = "visibility", nulls = Nulls.SKIP) + public Builder visibility(Optional visibility) { + this.visibility = visibility; + return this; + } + + public Builder visibility(UpdateToolTemplateDtoVisibility visibility) { + this.visibility = Optional.ofNullable(visibility); + return this; + } + + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "provider", nulls = Nulls.SKIP) + public Builder provider(Optional provider) { + this.provider = provider; + return this; + } + + public Builder provider(UpdateToolTemplateDtoProvider provider) { + this.provider = Optional.ofNullable(provider); + return this; + } + + public UpdateToolTemplateDto build() { + return new UpdateToolTemplateDto( + details, providerDetails, metadata, visibility, name, provider, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateToolTemplateDtoDetails.java b/src/main/java/com/vapi/api/types/UpdateToolTemplateDtoDetails.java new file mode 100644 index 0000000..adb8c82 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateToolTemplateDtoDetails.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class UpdateToolTemplateDtoDetails { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private UpdateToolTemplateDtoDetails(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static UpdateToolTemplateDtoDetails dtmf(CreateDtmfToolDto value) { + return new UpdateToolTemplateDtoDetails(new DtmfValue(value)); + } + + public static UpdateToolTemplateDtoDetails endCall(CreateEndCallToolDto value) { + return new UpdateToolTemplateDtoDetails(new EndCallValue(value)); + } + + public static UpdateToolTemplateDtoDetails voicemail(CreateVoicemailToolDto value) { + return new UpdateToolTemplateDtoDetails(new VoicemailValue(value)); + } + + public static UpdateToolTemplateDtoDetails function(CreateFunctionToolDto value) { + return new UpdateToolTemplateDtoDetails(new FunctionValue(value)); + } + + public static UpdateToolTemplateDtoDetails ghl(CreateGhlToolDto value) { + return new UpdateToolTemplateDtoDetails(new GhlValue(value)); + } + + public static UpdateToolTemplateDtoDetails make(CreateMakeToolDto value) { + return new UpdateToolTemplateDtoDetails(new MakeValue(value)); + } + + public static UpdateToolTemplateDtoDetails transferCall(CreateTransferCallToolDto value) { + return new UpdateToolTemplateDtoDetails(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolTemplateDtoDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolTemplateDtoDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolTemplateDtoDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolTemplateDtoDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolTemplateDtoDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolTemplateDtoDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolTemplateDtoDetails{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolTemplateDtoDetails{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateToolTemplateDtoProvider.java b/src/main/java/com/vapi/api/types/UpdateToolTemplateDtoProvider.java new file mode 100644 index 0000000..1f8053f --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateToolTemplateDtoProvider.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum UpdateToolTemplateDtoProvider { + MAKE("make"), + + GOHIGHLEVEL("gohighlevel"), + + FUNCTION("function"); + + private final String value; + + UpdateToolTemplateDtoProvider(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateToolTemplateDtoProviderDetails.java b/src/main/java/com/vapi/api/types/UpdateToolTemplateDtoProviderDetails.java new file mode 100644 index 0000000..856ef73 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateToolTemplateDtoProviderDetails.java @@ -0,0 +1,259 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class UpdateToolTemplateDtoProviderDetails { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private UpdateToolTemplateDtoProviderDetails(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static UpdateToolTemplateDtoProviderDetails make(MakeToolProviderDetails value) { + return new UpdateToolTemplateDtoProviderDetails(new MakeValue(value)); + } + + public static UpdateToolTemplateDtoProviderDetails ghl(GhlToolProviderDetails value) { + return new UpdateToolTemplateDtoProviderDetails(new GhlValue(value)); + } + + public static UpdateToolTemplateDtoProviderDetails function(FunctionToolProviderDetails value) { + return new UpdateToolTemplateDtoProviderDetails(new FunctionValue(value)); + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitMake(MakeToolProviderDetails make); + + T visitGhl(GhlToolProviderDetails ghl); + + T visitFunction(FunctionToolProviderDetails function); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(FunctionValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private MakeToolProviderDetails value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(MakeToolProviderDetails value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolTemplateDtoProviderDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private GhlToolProviderDetails value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(GhlToolProviderDetails value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolTemplateDtoProviderDetails{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private FunctionToolProviderDetails value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(FunctionToolProviderDetails value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolTemplateDtoProviderDetails{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "UpdateToolTemplateDtoProviderDetails{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateToolTemplateDtoVisibility.java b/src/main/java/com/vapi/api/types/UpdateToolTemplateDtoVisibility.java new file mode 100644 index 0000000..a34def1 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateToolTemplateDtoVisibility.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum UpdateToolTemplateDtoVisibility { + PUBLIC("public"), + + PRIVATE("private"); + + private final String value; + + UpdateToolTemplateDtoVisibility(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateTwilioCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateTwilioCredentialDto.java new file mode 100644 index 0000000..e6bbf02 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateTwilioCredentialDto.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateTwilioCredentialDto.Builder.class) +public final class UpdateTwilioCredentialDto { + private final String authToken; + + private final String accountSid; + + private final Map additionalProperties; + + private UpdateTwilioCredentialDto(String authToken, String accountSid, Map additionalProperties) { + this.authToken = authToken; + this.accountSid = accountSid; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "twilio"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("authToken") + public String getAuthToken() { + return authToken; + } + + @JsonProperty("accountSid") + public String getAccountSid() { + return accountSid; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateTwilioCredentialDto && equalTo((UpdateTwilioCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateTwilioCredentialDto other) { + return authToken.equals(other.authToken) && accountSid.equals(other.accountSid); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.authToken, this.accountSid); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AuthTokenStage builder() { + return new Builder(); + } + + public interface AuthTokenStage { + AccountSidStage authToken(@NotNull String authToken); + + Builder from(UpdateTwilioCredentialDto other); + } + + public interface AccountSidStage { + _FinalStage accountSid(@NotNull String accountSid); + } + + public interface _FinalStage { + UpdateTwilioCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AuthTokenStage, AccountSidStage, _FinalStage { + private String authToken; + + private String accountSid; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateTwilioCredentialDto other) { + authToken(other.getAuthToken()); + accountSid(other.getAccountSid()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("authToken") + public AccountSidStage authToken(@NotNull String authToken) { + this.authToken = Objects.requireNonNull(authToken, "authToken must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("accountSid") + public _FinalStage accountSid(@NotNull String accountSid) { + this.accountSid = Objects.requireNonNull(accountSid, "accountSid must not be null"); + return this; + } + + @java.lang.Override + public UpdateTwilioCredentialDto build() { + return new UpdateTwilioCredentialDto(authToken, accountSid, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateUserRoleDto.java b/src/main/java/com/vapi/api/types/UpdateUserRoleDto.java new file mode 100644 index 0000000..fe32e55 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateUserRoleDto.java @@ -0,0 +1,124 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateUserRoleDto.Builder.class) +public final class UpdateUserRoleDto { + private final String userId; + + private final UpdateUserRoleDtoRole role; + + private final Map additionalProperties; + + private UpdateUserRoleDto(String userId, UpdateUserRoleDtoRole role, Map additionalProperties) { + this.userId = userId; + this.role = role; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("userId") + public String getUserId() { + return userId; + } + + @JsonProperty("role") + public UpdateUserRoleDtoRole getRole() { + return role; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateUserRoleDto && equalTo((UpdateUserRoleDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateUserRoleDto other) { + return userId.equals(other.userId) && role.equals(other.role); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.userId, this.role); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static UserIdStage builder() { + return new Builder(); + } + + public interface UserIdStage { + RoleStage userId(@NotNull String userId); + + Builder from(UpdateUserRoleDto other); + } + + public interface RoleStage { + _FinalStage role(@NotNull UpdateUserRoleDtoRole role); + } + + public interface _FinalStage { + UpdateUserRoleDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements UserIdStage, RoleStage, _FinalStage { + private String userId; + + private UpdateUserRoleDtoRole role; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateUserRoleDto other) { + userId(other.getUserId()); + role(other.getRole()); + return this; + } + + @java.lang.Override + @JsonSetter("userId") + public RoleStage userId(@NotNull String userId) { + this.userId = Objects.requireNonNull(userId, "userId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("role") + public _FinalStage role(@NotNull UpdateUserRoleDtoRole role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + @java.lang.Override + public UpdateUserRoleDto build() { + return new UpdateUserRoleDto(userId, role, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateUserRoleDtoRole.java b/src/main/java/com/vapi/api/types/UpdateUserRoleDtoRole.java new file mode 100644 index 0000000..9a55913 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateUserRoleDtoRole.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum UpdateUserRoleDtoRole { + ADMIN("admin"), + + EDITOR("editor"), + + VIEWER("viewer"); + + private final String value; + + UpdateUserRoleDtoRole(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/UpdateVonageCredentialDto.java b/src/main/java/com/vapi/api/types/UpdateVonageCredentialDto.java new file mode 100644 index 0000000..cdd191b --- /dev/null +++ b/src/main/java/com/vapi/api/types/UpdateVonageCredentialDto.java @@ -0,0 +1,136 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateVonageCredentialDto.Builder.class) +public final class UpdateVonageCredentialDto { + private final String apiSecret; + + private final String apiKey; + + private final Map additionalProperties; + + private UpdateVonageCredentialDto(String apiSecret, String apiKey, Map additionalProperties) { + this.apiSecret = apiSecret; + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("provider") + public String getProvider() { + return "vonage"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiSecret") + public String getApiSecret() { + return apiSecret; + } + + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateVonageCredentialDto && equalTo((UpdateVonageCredentialDto) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateVonageCredentialDto other) { + return apiSecret.equals(other.apiSecret) && apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiSecret, this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ApiSecretStage builder() { + return new Builder(); + } + + public interface ApiSecretStage { + ApiKeyStage apiSecret(@NotNull String apiSecret); + + Builder from(UpdateVonageCredentialDto other); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + } + + public interface _FinalStage { + UpdateVonageCredentialDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ApiSecretStage, ApiKeyStage, _FinalStage { + private String apiSecret; + + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateVonageCredentialDto other) { + apiSecret(other.getApiSecret()); + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiSecret") + public ApiKeyStage apiSecret(@NotNull String apiSecret) { + this.apiSecret = Objects.requireNonNull(apiSecret, "apiSecret must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public UpdateVonageCredentialDto build() { + return new UpdateVonageCredentialDto(apiSecret, apiKey, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/User.java b/src/main/java/com/vapi/api/types/User.java new file mode 100644 index 0000000..9dc2a76 --- /dev/null +++ b/src/main/java/com/vapi/api/types/User.java @@ -0,0 +1,244 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = User.Builder.class) +public final class User { + private final String id; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final String email; + + private final Optional fullName; + + private final Map additionalProperties; + + private User( + String id, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + String email, + Optional fullName, + Map additionalProperties) { + this.id = id; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.email = email; + this.fullName = fullName; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the unique identifier for the profile or user. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the ISO 8601 date-time string of when the profile was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the profile was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the email of the user that is associated with the profile. + */ + @JsonProperty("email") + public String getEmail() { + return email; + } + + /** + * @return This is the full name of the user that is associated with the profile. + */ + @JsonProperty("fullName") + public Optional getFullName() { + return fullName; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof User && equalTo((User) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(User other) { + return id.equals(other.id) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && email.equals(other.email) + && fullName.equals(other.fullName); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.createdAt, this.updatedAt, this.email, this.fullName); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + CreatedAtStage id(@NotNull String id); + + Builder from(User other); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + EmailStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface EmailStage { + _FinalStage email(@NotNull String email); + } + + public interface _FinalStage { + User build(); + + _FinalStage fullName(Optional fullName); + + _FinalStage fullName(String fullName); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, CreatedAtStage, UpdatedAtStage, EmailStage, _FinalStage { + private String id; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private String email; + + private Optional fullName = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(User other) { + id(other.getId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + email(other.getEmail()); + fullName(other.getFullName()); + return this; + } + + /** + *

This is the unique identifier for the profile or user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public CreatedAtStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the profile was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the profile was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public EmailStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the email of the user that is associated with the profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("email") + public _FinalStage email(@NotNull String email) { + this.email = Objects.requireNonNull(email, "email must not be null"); + return this; + } + + /** + *

This is the full name of the user that is associated with the profile.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fullName(String fullName) { + this.fullName = Optional.ofNullable(fullName); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fullName", nulls = Nulls.SKIP) + public _FinalStage fullName(Optional fullName) { + this.fullName = fullName; + return this; + } + + @java.lang.Override + public User build() { + return new User(id, createdAt, updatedAt, email, fullName, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/UserMessage.java b/src/main/java/com/vapi/api/types/UserMessage.java new file mode 100644 index 0000000..b8d8a71 --- /dev/null +++ b/src/main/java/com/vapi/api/types/UserMessage.java @@ -0,0 +1,275 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UserMessage.Builder.class) +public final class UserMessage { + private final String role; + + private final String message; + + private final double time; + + private final double endTime; + + private final double secondsFromStart; + + private final Optional duration; + + private final Map additionalProperties; + + private UserMessage( + String role, + String message, + double time, + double endTime, + double secondsFromStart, + Optional duration, + Map additionalProperties) { + this.role = role; + this.message = message; + this.time = time; + this.endTime = endTime; + this.secondsFromStart = secondsFromStart; + this.duration = duration; + this.additionalProperties = additionalProperties; + } + + /** + * @return The role of the user in the conversation. + */ + @JsonProperty("role") + public String getRole() { + return role; + } + + /** + * @return The message content from the user. + */ + @JsonProperty("message") + public String getMessage() { + return message; + } + + /** + * @return The timestamp when the message was sent. + */ + @JsonProperty("time") + public double getTime() { + return time; + } + + /** + * @return The timestamp when the message ended. + */ + @JsonProperty("endTime") + public double getEndTime() { + return endTime; + } + + /** + * @return The number of seconds from the start of the conversation. + */ + @JsonProperty("secondsFromStart") + public double getSecondsFromStart() { + return secondsFromStart; + } + + /** + * @return The duration of the message in seconds. + */ + @JsonProperty("duration") + public Optional getDuration() { + return duration; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UserMessage && equalTo((UserMessage) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UserMessage other) { + return role.equals(other.role) + && message.equals(other.message) + && time == other.time + && endTime == other.endTime + && secondsFromStart == other.secondsFromStart + && duration.equals(other.duration); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.role, this.message, this.time, this.endTime, this.secondsFromStart, this.duration); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static RoleStage builder() { + return new Builder(); + } + + public interface RoleStage { + MessageStage role(@NotNull String role); + + Builder from(UserMessage other); + } + + public interface MessageStage { + TimeStage message(@NotNull String message); + } + + public interface TimeStage { + EndTimeStage time(double time); + } + + public interface EndTimeStage { + SecondsFromStartStage endTime(double endTime); + } + + public interface SecondsFromStartStage { + _FinalStage secondsFromStart(double secondsFromStart); + } + + public interface _FinalStage { + UserMessage build(); + + _FinalStage duration(Optional duration); + + _FinalStage duration(Double duration); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements RoleStage, MessageStage, TimeStage, EndTimeStage, SecondsFromStartStage, _FinalStage { + private String role; + + private String message; + + private double time; + + private double endTime; + + private double secondsFromStart; + + private Optional duration = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UserMessage other) { + role(other.getRole()); + message(other.getMessage()); + time(other.getTime()); + endTime(other.getEndTime()); + secondsFromStart(other.getSecondsFromStart()); + duration(other.getDuration()); + return this; + } + + /** + *

The role of the user in the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("role") + public MessageStage role(@NotNull String role) { + this.role = Objects.requireNonNull(role, "role must not be null"); + return this; + } + + /** + *

The message content from the user.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("message") + public TimeStage message(@NotNull String message) { + this.message = Objects.requireNonNull(message, "message must not be null"); + return this; + } + + /** + *

The timestamp when the message was sent.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("time") + public EndTimeStage time(double time) { + this.time = time; + return this; + } + + /** + *

The timestamp when the message ended.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("endTime") + public SecondsFromStartStage endTime(double endTime) { + this.endTime = endTime; + return this; + } + + /** + *

The number of seconds from the start of the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("secondsFromStart") + public _FinalStage secondsFromStart(double secondsFromStart) { + this.secondsFromStart = secondsFromStart; + return this; + } + + /** + *

The duration of the message in seconds.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage duration(Double duration) { + this.duration = Optional.ofNullable(duration); + return this; + } + + @java.lang.Override + @JsonSetter(value = "duration", nulls = Nulls.SKIP) + public _FinalStage duration(Optional duration) { + this.duration = duration; + return this; + } + + @java.lang.Override + public UserMessage build() { + return new UserMessage(role, message, time, endTime, secondsFromStart, duration, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/VapiCost.java b/src/main/java/com/vapi/api/types/VapiCost.java new file mode 100644 index 0000000..365a8e0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/VapiCost.java @@ -0,0 +1,137 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = VapiCost.Builder.class) +public final class VapiCost { + private final double minutes; + + private final double cost; + + private final Map additionalProperties; + + private VapiCost(double minutes, double cost, Map additionalProperties) { + this.minutes = minutes; + this.cost = cost; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the minutes of Vapi usage. This should match call.endedAt - call.startedAt. + */ + @JsonProperty("minutes") + public double getMinutes() { + return minutes; + } + + /** + * @return This is the cost of the component in USD. + */ + @JsonProperty("cost") + public double getCost() { + return cost; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiCost && equalTo((VapiCost) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(VapiCost other) { + return minutes == other.minutes && cost == other.cost; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.minutes, this.cost); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static MinutesStage builder() { + return new Builder(); + } + + public interface MinutesStage { + CostStage minutes(double minutes); + + Builder from(VapiCost other); + } + + public interface CostStage { + _FinalStage cost(double cost); + } + + public interface _FinalStage { + VapiCost build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements MinutesStage, CostStage, _FinalStage { + private double minutes; + + private double cost; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(VapiCost other) { + minutes(other.getMinutes()); + cost(other.getCost()); + return this; + } + + /** + *

This is the minutes of Vapi usage. This should match call.endedAt - call.startedAt.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("minutes") + public CostStage minutes(double minutes) { + this.minutes = minutes; + return this; + } + + /** + *

This is the cost of the component in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cost") + public _FinalStage cost(double cost) { + this.cost = cost; + return this; + } + + @java.lang.Override + public VapiCost build() { + return new VapiCost(minutes, cost, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/VapiModel.java b/src/main/java/com/vapi/api/types/VapiModel.java new file mode 100644 index 0000000..3b62644 --- /dev/null +++ b/src/main/java/com/vapi/api/types/VapiModel.java @@ -0,0 +1,473 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = VapiModel.Builder.class) +public final class VapiModel { + private final Optional> messages; + + private final Optional> tools; + + private final Optional> toolIds; + + private final Optional> steps; + + private final String model; + + private final Optional temperature; + + private final Optional knowledgeBase; + + private final Optional maxTokens; + + private final Optional emotionRecognitionEnabled; + + private final Optional numFastTurns; + + private final Map additionalProperties; + + private VapiModel( + Optional> messages, + Optional> tools, + Optional> toolIds, + Optional> steps, + String model, + Optional temperature, + Optional knowledgeBase, + Optional maxTokens, + Optional emotionRecognitionEnabled, + Optional numFastTurns, + Map additionalProperties) { + this.messages = messages; + this.tools = tools; + this.toolIds = toolIds; + this.steps = steps; + this.model = model; + this.temperature = temperature; + this.knowledgeBase = knowledgeBase; + this.maxTokens = maxTokens; + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + this.numFastTurns = numFastTurns; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the starting state for the conversation. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return These are the tools that the assistant can use during the call. To use existing tools, use toolIds. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("tools") + public Optional> getTools() { + return tools; + } + + /** + * @return These are the tools that the assistant can use during the call. To use transient tools, use tools. + *

Both tools and toolIds can be used together.

+ */ + @JsonProperty("toolIds") + public Optional> getToolIds() { + return toolIds; + } + + @JsonProperty("steps") + public Optional> getSteps() { + return steps; + } + + /** + * @return This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b + */ + @JsonProperty("model") + public String getModel() { + return model; + } + + /** + * @return This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. + */ + @JsonProperty("temperature") + public Optional getTemperature() { + return temperature; + } + + /** + * @return These are the options for the knowledge base. + */ + @JsonProperty("knowledgeBase") + public Optional getKnowledgeBase() { + return knowledgeBase; + } + + /** + * @return This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250. + */ + @JsonProperty("maxTokens") + public Optional getMaxTokens() { + return maxTokens; + } + + /** + * @return This determines whether we detect user's emotion while they speak and send it as an additional info to model. + *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ */ + @JsonProperty("emotionRecognitionEnabled") + public Optional getEmotionRecognitionEnabled() { + return emotionRecognitionEnabled; + } + + /** + * @return This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai. + *

Default is 0.

+ *

@default 0

+ */ + @JsonProperty("numFastTurns") + public Optional getNumFastTurns() { + return numFastTurns; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiModel && equalTo((VapiModel) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(VapiModel other) { + return messages.equals(other.messages) + && tools.equals(other.tools) + && toolIds.equals(other.toolIds) + && steps.equals(other.steps) + && model.equals(other.model) + && temperature.equals(other.temperature) + && knowledgeBase.equals(other.knowledgeBase) + && maxTokens.equals(other.maxTokens) + && emotionRecognitionEnabled.equals(other.emotionRecognitionEnabled) + && numFastTurns.equals(other.numFastTurns); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.messages, + this.tools, + this.toolIds, + this.steps, + this.model, + this.temperature, + this.knowledgeBase, + this.maxTokens, + this.emotionRecognitionEnabled, + this.numFastTurns); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ModelStage builder() { + return new Builder(); + } + + public interface ModelStage { + _FinalStage model(@NotNull String model); + + Builder from(VapiModel other); + } + + public interface _FinalStage { + VapiModel build(); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage tools(Optional> tools); + + _FinalStage tools(List tools); + + _FinalStage toolIds(Optional> toolIds); + + _FinalStage toolIds(List toolIds); + + _FinalStage steps(Optional> steps); + + _FinalStage steps(List steps); + + _FinalStage temperature(Optional temperature); + + _FinalStage temperature(Double temperature); + + _FinalStage knowledgeBase(Optional knowledgeBase); + + _FinalStage knowledgeBase(KnowledgeBase knowledgeBase); + + _FinalStage maxTokens(Optional maxTokens); + + _FinalStage maxTokens(Double maxTokens); + + _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled); + + _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled); + + _FinalStage numFastTurns(Optional numFastTurns); + + _FinalStage numFastTurns(Double numFastTurns); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ModelStage, _FinalStage { + private String model; + + private Optional numFastTurns = Optional.empty(); + + private Optional emotionRecognitionEnabled = Optional.empty(); + + private Optional maxTokens = Optional.empty(); + + private Optional knowledgeBase = Optional.empty(); + + private Optional temperature = Optional.empty(); + + private Optional> steps = Optional.empty(); + + private Optional> toolIds = Optional.empty(); + + private Optional> tools = Optional.empty(); + + private Optional> messages = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(VapiModel other) { + messages(other.getMessages()); + tools(other.getTools()); + toolIds(other.getToolIds()); + steps(other.getSteps()); + model(other.getModel()); + temperature(other.getTemperature()); + knowledgeBase(other.getKnowledgeBase()); + maxTokens(other.getMaxTokens()); + emotionRecognitionEnabled(other.getEmotionRecognitionEnabled()); + numFastTurns(other.getNumFastTurns()); + return this; + } + + /** + *

This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("model") + public _FinalStage model(@NotNull String model) { + this.model = Objects.requireNonNull(model, "model must not be null"); + return this; + } + + /** + *

This sets how many turns at the start of the conversation to use a smaller, faster model from the same provider before switching to the primary model. Example, gpt-3.5-turbo if provider is openai.

+ *

Default is 0.

+ *

@default 0

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage numFastTurns(Double numFastTurns) { + this.numFastTurns = Optional.ofNullable(numFastTurns); + return this; + } + + @java.lang.Override + @JsonSetter(value = "numFastTurns", nulls = Nulls.SKIP) + public _FinalStage numFastTurns(Optional numFastTurns) { + this.numFastTurns = numFastTurns; + return this; + } + + /** + *

This determines whether we detect user's emotion while they speak and send it as an additional info to model.

+ *

Default false because the model is usually are good at understanding the user's emotion from text.

+ *

@default false

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage emotionRecognitionEnabled(Boolean emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = Optional.ofNullable(emotionRecognitionEnabled); + return this; + } + + @java.lang.Override + @JsonSetter(value = "emotionRecognitionEnabled", nulls = Nulls.SKIP) + public _FinalStage emotionRecognitionEnabled(Optional emotionRecognitionEnabled) { + this.emotionRecognitionEnabled = emotionRecognitionEnabled; + return this; + } + + /** + *

This is the max number of tokens that the assistant will be allowed to generate in each turn of the conversation. Default is 250.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage maxTokens(Double maxTokens) { + this.maxTokens = Optional.ofNullable(maxTokens); + return this; + } + + @java.lang.Override + @JsonSetter(value = "maxTokens", nulls = Nulls.SKIP) + public _FinalStage maxTokens(Optional maxTokens) { + this.maxTokens = maxTokens; + return this; + } + + /** + *

These are the options for the knowledge base.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage knowledgeBase(KnowledgeBase knowledgeBase) { + this.knowledgeBase = Optional.ofNullable(knowledgeBase); + return this; + } + + @java.lang.Override + @JsonSetter(value = "knowledgeBase", nulls = Nulls.SKIP) + public _FinalStage knowledgeBase(Optional knowledgeBase) { + this.knowledgeBase = knowledgeBase; + return this; + } + + /** + *

This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage temperature(Double temperature) { + this.temperature = Optional.ofNullable(temperature); + return this; + } + + @java.lang.Override + @JsonSetter(value = "temperature", nulls = Nulls.SKIP) + public _FinalStage temperature(Optional temperature) { + this.temperature = temperature; + return this; + } + + @java.lang.Override + public _FinalStage steps(List steps) { + this.steps = Optional.ofNullable(steps); + return this; + } + + @java.lang.Override + @JsonSetter(value = "steps", nulls = Nulls.SKIP) + public _FinalStage steps(Optional> steps) { + this.steps = steps; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use transient tools, use tools.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage toolIds(List toolIds) { + this.toolIds = Optional.ofNullable(toolIds); + return this; + } + + @java.lang.Override + @JsonSetter(value = "toolIds", nulls = Nulls.SKIP) + public _FinalStage toolIds(Optional> toolIds) { + this.toolIds = toolIds; + return this; + } + + /** + *

These are the tools that the assistant can use during the call. To use existing tools, use toolIds.

+ *

Both tools and toolIds can be used together.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tools(List tools) { + this.tools = Optional.ofNullable(tools); + return this; + } + + @java.lang.Override + @JsonSetter(value = "tools", nulls = Nulls.SKIP) + public _FinalStage tools(Optional> tools) { + this.tools = tools; + return this; + } + + /** + *

This is the starting state for the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + @java.lang.Override + public VapiModel build() { + return new VapiModel( + messages, + tools, + toolIds, + steps, + model, + temperature, + knowledgeBase, + maxTokens, + emotionRecognitionEnabled, + numFastTurns, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/VapiModelStepsItem.java b/src/main/java/com/vapi/api/types/VapiModelStepsItem.java new file mode 100644 index 0000000..fa28047 --- /dev/null +++ b/src/main/java/com/vapi/api/types/VapiModelStepsItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class VapiModelStepsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private VapiModelStepsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static VapiModelStepsItem handoff(HandoffStep value) { + return new VapiModelStepsItem(new HandoffValue(value)); + } + + public static VapiModelStepsItem callback(CallbackStep value) { + return new VapiModelStepsItem(new CallbackValue(value)); + } + + public boolean isHandoff() { + return value instanceof HandoffValue; + } + + public boolean isCallback() { + return value instanceof CallbackValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getHandoff() { + if (isHandoff()) { + return Optional.of(((HandoffValue) value).value); + } + return Optional.empty(); + } + + public Optional getCallback() { + if (isCallback()) { + return Optional.of(((CallbackValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitHandoff(HandoffStep handoff); + + T visitCallback(CallbackStep callback); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(HandoffValue.class), @JsonSubTypes.Type(CallbackValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("handoff") + private static final class HandoffValue implements Value { + @JsonUnwrapped + private HandoffStep value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private HandoffValue() {} + + private HandoffValue(HandoffStep value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitHandoff(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof HandoffValue && equalTo((HandoffValue) other); + } + + private boolean equalTo(HandoffValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "VapiModelStepsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("callback") + private static final class CallbackValue implements Value { + @JsonUnwrapped + private CallbackStep value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CallbackValue() {} + + private CallbackValue(CallbackStep value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCallback(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CallbackValue && equalTo((CallbackValue) other); + } + + private boolean equalTo(CallbackValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "VapiModelStepsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "VapiModelStepsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/VapiModelToolsItem.java b/src/main/java/com/vapi/api/types/VapiModelToolsItem.java new file mode 100644 index 0000000..b75124a --- /dev/null +++ b/src/main/java/com/vapi/api/types/VapiModelToolsItem.java @@ -0,0 +1,483 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class VapiModelToolsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private VapiModelToolsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static VapiModelToolsItem dtmf(CreateDtmfToolDto value) { + return new VapiModelToolsItem(new DtmfValue(value)); + } + + public static VapiModelToolsItem endCall(CreateEndCallToolDto value) { + return new VapiModelToolsItem(new EndCallValue(value)); + } + + public static VapiModelToolsItem voicemail(CreateVoicemailToolDto value) { + return new VapiModelToolsItem(new VoicemailValue(value)); + } + + public static VapiModelToolsItem function(CreateFunctionToolDto value) { + return new VapiModelToolsItem(new FunctionValue(value)); + } + + public static VapiModelToolsItem ghl(CreateGhlToolDto value) { + return new VapiModelToolsItem(new GhlValue(value)); + } + + public static VapiModelToolsItem make(CreateMakeToolDto value) { + return new VapiModelToolsItem(new MakeValue(value)); + } + + public static VapiModelToolsItem transferCall(CreateTransferCallToolDto value) { + return new VapiModelToolsItem(new TransferCallValue(value)); + } + + public boolean isDtmf() { + return value instanceof DtmfValue; + } + + public boolean isEndCall() { + return value instanceof EndCallValue; + } + + public boolean isVoicemail() { + return value instanceof VoicemailValue; + } + + public boolean isFunction() { + return value instanceof FunctionValue; + } + + public boolean isGhl() { + return value instanceof GhlValue; + } + + public boolean isMake() { + return value instanceof MakeValue; + } + + public boolean isTransferCall() { + return value instanceof TransferCallValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getDtmf() { + if (isDtmf()) { + return Optional.of(((DtmfValue) value).value); + } + return Optional.empty(); + } + + public Optional getEndCall() { + if (isEndCall()) { + return Optional.of(((EndCallValue) value).value); + } + return Optional.empty(); + } + + public Optional getVoicemail() { + if (isVoicemail()) { + return Optional.of(((VoicemailValue) value).value); + } + return Optional.empty(); + } + + public Optional getFunction() { + if (isFunction()) { + return Optional.of(((FunctionValue) value).value); + } + return Optional.empty(); + } + + public Optional getGhl() { + if (isGhl()) { + return Optional.of(((GhlValue) value).value); + } + return Optional.empty(); + } + + public Optional getMake() { + if (isMake()) { + return Optional.of(((MakeValue) value).value); + } + return Optional.empty(); + } + + public Optional getTransferCall() { + if (isTransferCall()) { + return Optional.of(((TransferCallValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitDtmf(CreateDtmfToolDto dtmf); + + T visitEndCall(CreateEndCallToolDto endCall); + + T visitVoicemail(CreateVoicemailToolDto voicemail); + + T visitFunction(CreateFunctionToolDto function); + + T visitGhl(CreateGhlToolDto ghl); + + T visitMake(CreateMakeToolDto make); + + T visitTransferCall(CreateTransferCallToolDto transferCall); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({ + @JsonSubTypes.Type(DtmfValue.class), + @JsonSubTypes.Type(EndCallValue.class), + @JsonSubTypes.Type(VoicemailValue.class), + @JsonSubTypes.Type(FunctionValue.class), + @JsonSubTypes.Type(GhlValue.class), + @JsonSubTypes.Type(MakeValue.class), + @JsonSubTypes.Type(TransferCallValue.class) + }) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("dtmf") + private static final class DtmfValue implements Value { + @JsonUnwrapped + private CreateDtmfToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private DtmfValue() {} + + private DtmfValue(CreateDtmfToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitDtmf(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DtmfValue && equalTo((DtmfValue) other); + } + + private boolean equalTo(DtmfValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "VapiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("endCall") + private static final class EndCallValue implements Value { + @JsonUnwrapped + private CreateEndCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private EndCallValue() {} + + private EndCallValue(CreateEndCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitEndCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EndCallValue && equalTo((EndCallValue) other); + } + + private boolean equalTo(EndCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "VapiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("voicemail") + private static final class VoicemailValue implements Value { + @JsonUnwrapped + private CreateVoicemailToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private VoicemailValue() {} + + private VoicemailValue(CreateVoicemailToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitVoicemail(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoicemailValue && equalTo((VoicemailValue) other); + } + + private boolean equalTo(VoicemailValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "VapiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("function") + private static final class FunctionValue implements Value { + @JsonUnwrapped + private CreateFunctionToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private FunctionValue() {} + + private FunctionValue(CreateFunctionToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitFunction(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FunctionValue && equalTo((FunctionValue) other); + } + + private boolean equalTo(FunctionValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "VapiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("ghl") + private static final class GhlValue implements Value { + @JsonUnwrapped + private CreateGhlToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private GhlValue() {} + + private GhlValue(CreateGhlToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitGhl(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GhlValue && equalTo((GhlValue) other); + } + + private boolean equalTo(GhlValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "VapiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("make") + private static final class MakeValue implements Value { + @JsonUnwrapped + private CreateMakeToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private MakeValue() {} + + private MakeValue(CreateMakeToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitMake(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof MakeValue && equalTo((MakeValue) other); + } + + private boolean equalTo(MakeValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "VapiModelToolsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("transferCall") + private static final class TransferCallValue implements Value { + @JsonUnwrapped + private CreateTransferCallToolDto value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private TransferCallValue() {} + + private TransferCallValue(CreateTransferCallToolDto value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitTransferCall(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TransferCallValue && equalTo((TransferCallValue) other); + } + + private boolean equalTo(TransferCallValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "VapiModelToolsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "VapiModelToolsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/VapiPhoneNumber.java b/src/main/java/com/vapi/api/types/VapiPhoneNumber.java new file mode 100644 index 0000000..096ccdf --- /dev/null +++ b/src/main/java/com/vapi/api/types/VapiPhoneNumber.java @@ -0,0 +1,508 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = VapiPhoneNumber.Builder.class) +public final class VapiPhoneNumber { + private final Optional fallbackDestination; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional name; + + private final Optional assistantId; + + private final Optional squadId; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final String sipUri; + + private final Map additionalProperties; + + private VapiPhoneNumber( + Optional fallbackDestination, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional name, + Optional assistantId, + Optional squadId, + Optional serverUrl, + Optional serverUrlSecret, + String sipUri, + Map additionalProperties) { + this.fallbackDestination = fallbackDestination; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.name = name; + this.assistantId = assistantId; + this.squadId = squadId; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.sipUri = sipUri; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the fallback destination an inbound call will be transferred to if: + *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ */ + @JsonProperty("fallbackDestination") + public Optional getFallbackDestination() { + return fallbackDestination; + } + + /** + * @return This is the unique identifier for the phone number. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this phone number belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the phone number was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the phone number was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the name of the phone number. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the assistant that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the squad that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message. + *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + /** + * @return This is the SIP URI of the phone number. You can SIP INVITE this. The assistant attached to this number will answer. + *

This is case-insensitive.

+ */ + @JsonProperty("sipUri") + public String getSipUri() { + return sipUri; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VapiPhoneNumber && equalTo((VapiPhoneNumber) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(VapiPhoneNumber other) { + return fallbackDestination.equals(other.fallbackDestination) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && name.equals(other.name) + && assistantId.equals(other.assistantId) + && squadId.equals(other.squadId) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret) + && sipUri.equals(other.sipUri); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fallbackDestination, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.name, + this.assistantId, + this.squadId, + this.serverUrl, + this.serverUrlSecret, + this.sipUri); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(VapiPhoneNumber other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + SipUriStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface SipUriStage { + _FinalStage sipUri(@NotNull String sipUri); + } + + public interface _FinalStage { + VapiPhoneNumber build(); + + _FinalStage fallbackDestination(Optional fallbackDestination); + + _FinalStage fallbackDestination(VapiPhoneNumberFallbackDestination fallbackDestination); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage assistantId(Optional assistantId); + + _FinalStage assistantId(String assistantId); + + _FinalStage squadId(Optional squadId); + + _FinalStage squadId(String squadId); + + _FinalStage serverUrl(Optional serverUrl); + + _FinalStage serverUrl(String serverUrl); + + _FinalStage serverUrlSecret(Optional serverUrlSecret); + + _FinalStage serverUrlSecret(String serverUrlSecret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, SipUriStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private String sipUri; + + private Optional serverUrlSecret = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional fallbackDestination = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(VapiPhoneNumber other) { + fallbackDestination(other.getFallbackDestination()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + name(other.getName()); + assistantId(other.getAssistantId()); + squadId(other.getSquadId()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + sipUri(other.getSipUri()); + return this; + } + + /** + *

This is the unique identifier for the phone number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this phone number belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the phone number was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the phone number was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public SipUriStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the SIP URI of the phone number. You can SIP INVITE this. The assistant attached to this number will answer.

+ *

This is case-insensitive.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("sipUri") + public _FinalStage sipUri(@NotNull String sipUri) { + this.sipUri = Objects.requireNonNull(sipUri, "sipUri must not be null"); + return this; + } + + /** + *

This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret.

+ *

Same precedence logic as serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public _FinalStage serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + /** + *

This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message.

+ *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public _FinalStage serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + /** + *

This is the squad that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public _FinalStage squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + /** + *

This is the assistant that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public _FinalStage assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + /** + *

This is the name of the phone number. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the fallback destination an inbound call will be transferred to if:

+ *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fallbackDestination(VapiPhoneNumberFallbackDestination fallbackDestination) { + this.fallbackDestination = Optional.ofNullable(fallbackDestination); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fallbackDestination", nulls = Nulls.SKIP) + public _FinalStage fallbackDestination(Optional fallbackDestination) { + this.fallbackDestination = fallbackDestination; + return this; + } + + @java.lang.Override + public VapiPhoneNumber build() { + return new VapiPhoneNumber( + fallbackDestination, + id, + orgId, + createdAt, + updatedAt, + name, + assistantId, + squadId, + serverUrl, + serverUrlSecret, + sipUri, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/VapiPhoneNumberFallbackDestination.java b/src/main/java/com/vapi/api/types/VapiPhoneNumberFallbackDestination.java new file mode 100644 index 0000000..48895d0 --- /dev/null +++ b/src/main/java/com/vapi/api/types/VapiPhoneNumberFallbackDestination.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class VapiPhoneNumberFallbackDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private VapiPhoneNumberFallbackDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static VapiPhoneNumberFallbackDestination number(TransferDestinationNumber value) { + return new VapiPhoneNumberFallbackDestination(new NumberValue(value)); + } + + public static VapiPhoneNumberFallbackDestination sip(TransferDestinationSip value) { + return new VapiPhoneNumberFallbackDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "VapiPhoneNumberFallbackDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "VapiPhoneNumberFallbackDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "VapiPhoneNumberFallbackDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/VoiceCost.java b/src/main/java/com/vapi/api/types/VoiceCost.java new file mode 100644 index 0000000..1a37c2c --- /dev/null +++ b/src/main/java/com/vapi/api/types/VoiceCost.java @@ -0,0 +1,215 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = VoiceCost.Builder.class) +public final class VoiceCost { + private final Map voice; + + private final double characters; + + private final double cost; + + private final Map additionalProperties; + + private VoiceCost( + Map voice, double characters, double cost, Map additionalProperties) { + this.voice = voice; + this.characters = characters; + this.cost = cost; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the voice that was used during the call. + *

This matches one of the following:

+ *
    + *
  • call.assistant.voice,
  • + *
  • call.assistantId->voice,
  • + *
  • call.squad[n].assistant.voice,
  • + *
  • call.squad[n].assistantId->voice,
  • + *
  • call.squadId->[n].assistant.voice,
  • + *
  • call.squadId->[n].assistantId->voice.
  • + *
+ */ + @JsonProperty("voice") + public Map getVoice() { + return voice; + } + + /** + * @return This is the number of characters that were generated during the call. These should be total characters used in the call for single assistant calls, while squad calls will have multiple voice costs one for each assistant that was used. + */ + @JsonProperty("characters") + public double getCharacters() { + return characters; + } + + /** + * @return This is the cost of the component in USD. + */ + @JsonProperty("cost") + public double getCost() { + return cost; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoiceCost && equalTo((VoiceCost) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(VoiceCost other) { + return voice.equals(other.voice) && characters == other.characters && cost == other.cost; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.voice, this.characters, this.cost); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static CharactersStage builder() { + return new Builder(); + } + + public interface CharactersStage { + CostStage characters(double characters); + + Builder from(VoiceCost other); + } + + public interface CostStage { + _FinalStage cost(double cost); + } + + public interface _FinalStage { + VoiceCost build(); + + _FinalStage voice(Map voice); + + _FinalStage putAllVoice(Map voice); + + _FinalStage voice(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CharactersStage, CostStage, _FinalStage { + private double characters; + + private double cost; + + private Map voice = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(VoiceCost other) { + voice(other.getVoice()); + characters(other.getCharacters()); + cost(other.getCost()); + return this; + } + + /** + *

This is the number of characters that were generated during the call. These should be total characters used in the call for single assistant calls, while squad calls will have multiple voice costs one for each assistant that was used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("characters") + public CostStage characters(double characters) { + this.characters = characters; + return this; + } + + /** + *

This is the cost of the component in USD.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cost") + public _FinalStage cost(double cost) { + this.cost = cost; + return this; + } + + /** + *

This is the voice that was used during the call.

+ *

This matches one of the following:

+ *
    + *
  • call.assistant.voice,
  • + *
  • call.assistantId->voice,
  • + *
  • call.squad[n].assistant.voice,
  • + *
  • call.squad[n].assistantId->voice,
  • + *
  • call.squadId->[n].assistant.voice,
  • + *
  • call.squadId->[n].assistantId->voice.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage voice(String key, Object value) { + this.voice.put(key, value); + return this; + } + + /** + *

This is the voice that was used during the call.

+ *

This matches one of the following:

+ *
    + *
  • call.assistant.voice,
  • + *
  • call.assistantId->voice,
  • + *
  • call.squad[n].assistant.voice,
  • + *
  • call.squad[n].assistantId->voice,
  • + *
  • call.squadId->[n].assistant.voice,
  • + *
  • call.squadId->[n].assistantId->voice.
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllVoice(Map voice) { + this.voice.putAll(voice); + return this; + } + + @java.lang.Override + @JsonSetter(value = "voice", nulls = Nulls.SKIP) + public _FinalStage voice(Map voice) { + this.voice.clear(); + this.voice.putAll(voice); + return this; + } + + @java.lang.Override + public VoiceCost build() { + return new VoiceCost(voice, characters, cost, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/VoiceLibrary.java b/src/main/java/com/vapi/api/types/VoiceLibrary.java new file mode 100644 index 0000000..b8d7887 --- /dev/null +++ b/src/main/java/com/vapi/api/types/VoiceLibrary.java @@ -0,0 +1,790 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = VoiceLibrary.Builder.class) +public final class VoiceLibrary { + private final Optional> provider; + + private final Optional providerId; + + private final Optional slug; + + private final Optional name; + + private final Optional language; + + private final Optional languageCode; + + private final Optional model; + + private final Optional supportedModels; + + private final Optional gender; + + private final Optional accent; + + private final Optional previewUrl; + + private final Optional description; + + private final Optional credentialId; + + private final String id; + + private final String orgId; + + private final boolean isPublic; + + private final boolean isDeleted; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Map additionalProperties; + + private VoiceLibrary( + Optional> provider, + Optional providerId, + Optional slug, + Optional name, + Optional language, + Optional languageCode, + Optional model, + Optional supportedModels, + Optional gender, + Optional accent, + Optional previewUrl, + Optional description, + Optional credentialId, + String id, + String orgId, + boolean isPublic, + boolean isDeleted, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Map additionalProperties) { + this.provider = provider; + this.providerId = providerId; + this.slug = slug; + this.name = name; + this.language = language; + this.languageCode = languageCode; + this.model = model; + this.supportedModels = supportedModels; + this.gender = gender; + this.accent = accent; + this.previewUrl = previewUrl; + this.description = description; + this.credentialId = credentialId; + this.id = id; + this.orgId = orgId; + this.isPublic = isPublic; + this.isDeleted = isDeleted; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the voice provider that will be used. + */ + @JsonProperty("provider") + public Optional> getProvider() { + return provider; + } + + /** + * @return The ID of the voice provided by the provider. + */ + @JsonProperty("providerId") + public Optional getProviderId() { + return providerId; + } + + /** + * @return The unique slug of the voice. + */ + @JsonProperty("slug") + public Optional getSlug() { + return slug; + } + + /** + * @return The name of the voice. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return The language of the voice. + */ + @JsonProperty("language") + public Optional getLanguage() { + return language; + } + + /** + * @return The language code of the voice. + */ + @JsonProperty("languageCode") + public Optional getLanguageCode() { + return languageCode; + } + + /** + * @return The model of the voice. + */ + @JsonProperty("model") + public Optional getModel() { + return model; + } + + /** + * @return The supported models of the voice. + */ + @JsonProperty("supportedModels") + public Optional getSupportedModels() { + return supportedModels; + } + + /** + * @return The gender of the voice. + */ + @JsonProperty("gender") + public Optional getGender() { + return gender; + } + + /** + * @return The accent of the voice. + */ + @JsonProperty("accent") + public Optional getAccent() { + return accent; + } + + /** + * @return The preview URL of the voice. + */ + @JsonProperty("previewUrl") + public Optional getPreviewUrl() { + return previewUrl; + } + + /** + * @return The description of the voice. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The credential ID of the voice. + */ + @JsonProperty("credentialId") + public Optional getCredentialId() { + return credentialId; + } + + /** + * @return The unique identifier for the voice library. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The unique identifier for the organization that this voice library belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return The Public voice is shared accross all the organizations. + */ + @JsonProperty("isPublic") + public boolean getIsPublic() { + return isPublic; + } + + /** + * @return The deletion status of the voice. + */ + @JsonProperty("isDeleted") + public boolean getIsDeleted() { + return isDeleted; + } + + /** + * @return The ISO 8601 date-time string of when the voice library was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return The ISO 8601 date-time string of when the voice library was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoiceLibrary && equalTo((VoiceLibrary) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(VoiceLibrary other) { + return provider.equals(other.provider) + && providerId.equals(other.providerId) + && slug.equals(other.slug) + && name.equals(other.name) + && language.equals(other.language) + && languageCode.equals(other.languageCode) + && model.equals(other.model) + && supportedModels.equals(other.supportedModels) + && gender.equals(other.gender) + && accent.equals(other.accent) + && previewUrl.equals(other.previewUrl) + && description.equals(other.description) + && credentialId.equals(other.credentialId) + && id.equals(other.id) + && orgId.equals(other.orgId) + && isPublic == other.isPublic + && isDeleted == other.isDeleted + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.provider, + this.providerId, + this.slug, + this.name, + this.language, + this.languageCode, + this.model, + this.supportedModels, + this.gender, + this.accent, + this.previewUrl, + this.description, + this.credentialId, + this.id, + this.orgId, + this.isPublic, + this.isDeleted, + this.createdAt, + this.updatedAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(VoiceLibrary other); + } + + public interface OrgIdStage { + IsPublicStage orgId(@NotNull String orgId); + } + + public interface IsPublicStage { + IsDeletedStage isPublic(boolean isPublic); + } + + public interface IsDeletedStage { + CreatedAtStage isDeleted(boolean isDeleted); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + VoiceLibrary build(); + + _FinalStage provider(Optional> provider); + + _FinalStage provider(Map provider); + + _FinalStage providerId(Optional providerId); + + _FinalStage providerId(String providerId); + + _FinalStage slug(Optional slug); + + _FinalStage slug(String slug); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage language(Optional language); + + _FinalStage language(String language); + + _FinalStage languageCode(Optional languageCode); + + _FinalStage languageCode(String languageCode); + + _FinalStage model(Optional model); + + _FinalStage model(String model); + + _FinalStage supportedModels(Optional supportedModels); + + _FinalStage supportedModels(String supportedModels); + + _FinalStage gender(Optional gender); + + _FinalStage gender(VoiceLibraryGender gender); + + _FinalStage accent(Optional accent); + + _FinalStage accent(String accent); + + _FinalStage previewUrl(Optional previewUrl); + + _FinalStage previewUrl(String previewUrl); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage credentialId(Optional credentialId); + + _FinalStage credentialId(String credentialId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, OrgIdStage, IsPublicStage, IsDeletedStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String orgId; + + private boolean isPublic; + + private boolean isDeleted; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional credentialId = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional previewUrl = Optional.empty(); + + private Optional accent = Optional.empty(); + + private Optional gender = Optional.empty(); + + private Optional supportedModels = Optional.empty(); + + private Optional model = Optional.empty(); + + private Optional languageCode = Optional.empty(); + + private Optional language = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional slug = Optional.empty(); + + private Optional providerId = Optional.empty(); + + private Optional> provider = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(VoiceLibrary other) { + provider(other.getProvider()); + providerId(other.getProviderId()); + slug(other.getSlug()); + name(other.getName()); + language(other.getLanguage()); + languageCode(other.getLanguageCode()); + model(other.getModel()); + supportedModels(other.getSupportedModels()); + gender(other.getGender()); + accent(other.getAccent()); + previewUrl(other.getPreviewUrl()); + description(other.getDescription()); + credentialId(other.getCredentialId()); + id(other.getId()); + orgId(other.getOrgId()); + isPublic(other.getIsPublic()); + isDeleted(other.getIsDeleted()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + return this; + } + + /** + *

The unique identifier for the voice library.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

The unique identifier for the organization that this voice library belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public IsPublicStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

The Public voice is shared accross all the organizations.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("isPublic") + public IsDeletedStage isPublic(boolean isPublic) { + this.isPublic = isPublic; + return this; + } + + /** + *

The deletion status of the voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("isDeleted") + public CreatedAtStage isDeleted(boolean isDeleted) { + this.isDeleted = isDeleted; + return this; + } + + /** + *

The ISO 8601 date-time string of when the voice library was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

The ISO 8601 date-time string of when the voice library was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

The credential ID of the voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage credentialId(String credentialId) { + this.credentialId = Optional.ofNullable(credentialId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "credentialId", nulls = Nulls.SKIP) + public _FinalStage credentialId(Optional credentialId) { + this.credentialId = credentialId; + return this; + } + + /** + *

The description of the voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

The preview URL of the voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage previewUrl(String previewUrl) { + this.previewUrl = Optional.ofNullable(previewUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "previewUrl", nulls = Nulls.SKIP) + public _FinalStage previewUrl(Optional previewUrl) { + this.previewUrl = previewUrl; + return this; + } + + /** + *

The accent of the voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage accent(String accent) { + this.accent = Optional.ofNullable(accent); + return this; + } + + @java.lang.Override + @JsonSetter(value = "accent", nulls = Nulls.SKIP) + public _FinalStage accent(Optional accent) { + this.accent = accent; + return this; + } + + /** + *

The gender of the voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage gender(VoiceLibraryGender gender) { + this.gender = Optional.ofNullable(gender); + return this; + } + + @java.lang.Override + @JsonSetter(value = "gender", nulls = Nulls.SKIP) + public _FinalStage gender(Optional gender) { + this.gender = gender; + return this; + } + + /** + *

The supported models of the voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage supportedModels(String supportedModels) { + this.supportedModels = Optional.ofNullable(supportedModels); + return this; + } + + @java.lang.Override + @JsonSetter(value = "supportedModels", nulls = Nulls.SKIP) + public _FinalStage supportedModels(Optional supportedModels) { + this.supportedModels = supportedModels; + return this; + } + + /** + *

The model of the voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage model(String model) { + this.model = Optional.ofNullable(model); + return this; + } + + @java.lang.Override + @JsonSetter(value = "model", nulls = Nulls.SKIP) + public _FinalStage model(Optional model) { + this.model = model; + return this; + } + + /** + *

The language code of the voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage languageCode(String languageCode) { + this.languageCode = Optional.ofNullable(languageCode); + return this; + } + + @java.lang.Override + @JsonSetter(value = "languageCode", nulls = Nulls.SKIP) + public _FinalStage languageCode(Optional languageCode) { + this.languageCode = languageCode; + return this; + } + + /** + *

The language of the voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage language(String language) { + this.language = Optional.ofNullable(language); + return this; + } + + @java.lang.Override + @JsonSetter(value = "language", nulls = Nulls.SKIP) + public _FinalStage language(Optional language) { + this.language = language; + return this; + } + + /** + *

The name of the voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

The unique slug of the voice.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage slug(String slug) { + this.slug = Optional.ofNullable(slug); + return this; + } + + @java.lang.Override + @JsonSetter(value = "slug", nulls = Nulls.SKIP) + public _FinalStage slug(Optional slug) { + this.slug = slug; + return this; + } + + /** + *

The ID of the voice provided by the provider.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage providerId(String providerId) { + this.providerId = Optional.ofNullable(providerId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "providerId", nulls = Nulls.SKIP) + public _FinalStage providerId(Optional providerId) { + this.providerId = providerId; + return this; + } + + /** + *

This is the voice provider that will be used.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage provider(Map provider) { + this.provider = Optional.ofNullable(provider); + return this; + } + + @java.lang.Override + @JsonSetter(value = "provider", nulls = Nulls.SKIP) + public _FinalStage provider(Optional> provider) { + this.provider = provider; + return this; + } + + @java.lang.Override + public VoiceLibrary build() { + return new VoiceLibrary( + provider, + providerId, + slug, + name, + language, + languageCode, + model, + supportedModels, + gender, + accent, + previewUrl, + description, + credentialId, + id, + orgId, + isPublic, + isDeleted, + createdAt, + updatedAt, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/VoiceLibraryGender.java b/src/main/java/com/vapi/api/types/VoiceLibraryGender.java new file mode 100644 index 0000000..e135c70 --- /dev/null +++ b/src/main/java/com/vapi/api/types/VoiceLibraryGender.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum VoiceLibraryGender { + MALE("male"), + + FEMALE("female"); + + private final String value; + + VoiceLibraryGender(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/vapi/api/types/VoiceLibraryVoiceResponse.java b/src/main/java/com/vapi/api/types/VoiceLibraryVoiceResponse.java new file mode 100644 index 0000000..de1b911 --- /dev/null +++ b/src/main/java/com/vapi/api/types/VoiceLibraryVoiceResponse.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = VoiceLibraryVoiceResponse.Builder.class) +public final class VoiceLibraryVoiceResponse { + private final String voiceId; + + private final String name; + + private final Optional publicOwnerId; + + private final Optional description; + + private final Optional gender; + + private final Optional> age; + + private final Optional accent; + + private final Map additionalProperties; + + private VoiceLibraryVoiceResponse( + String voiceId, + String name, + Optional publicOwnerId, + Optional description, + Optional gender, + Optional> age, + Optional accent, + Map additionalProperties) { + this.voiceId = voiceId; + this.name = name; + this.publicOwnerId = publicOwnerId; + this.description = description; + this.gender = gender; + this.age = age; + this.accent = accent; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("voiceId") + public String getVoiceId() { + return voiceId; + } + + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("publicOwnerId") + public Optional getPublicOwnerId() { + return publicOwnerId; + } + + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @JsonProperty("gender") + public Optional getGender() { + return gender; + } + + @JsonProperty("age") + public Optional> getAge() { + return age; + } + + @JsonProperty("accent") + public Optional getAccent() { + return accent; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VoiceLibraryVoiceResponse && equalTo((VoiceLibraryVoiceResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(VoiceLibraryVoiceResponse other) { + return voiceId.equals(other.voiceId) + && name.equals(other.name) + && publicOwnerId.equals(other.publicOwnerId) + && description.equals(other.description) + && gender.equals(other.gender) + && age.equals(other.age) + && accent.equals(other.accent); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.voiceId, this.name, this.publicOwnerId, this.description, this.gender, this.age, this.accent); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VoiceIdStage builder() { + return new Builder(); + } + + public interface VoiceIdStage { + NameStage voiceId(@NotNull String voiceId); + + Builder from(VoiceLibraryVoiceResponse other); + } + + public interface NameStage { + _FinalStage name(@NotNull String name); + } + + public interface _FinalStage { + VoiceLibraryVoiceResponse build(); + + _FinalStage publicOwnerId(Optional publicOwnerId); + + _FinalStage publicOwnerId(String publicOwnerId); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + + _FinalStage gender(Optional gender); + + _FinalStage gender(String gender); + + _FinalStage age(Optional> age); + + _FinalStage age(Map age); + + _FinalStage accent(Optional accent); + + _FinalStage accent(String accent); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements VoiceIdStage, NameStage, _FinalStage { + private String voiceId; + + private String name; + + private Optional accent = Optional.empty(); + + private Optional> age = Optional.empty(); + + private Optional gender = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional publicOwnerId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(VoiceLibraryVoiceResponse other) { + voiceId(other.getVoiceId()); + name(other.getName()); + publicOwnerId(other.getPublicOwnerId()); + description(other.getDescription()); + gender(other.getGender()); + age(other.getAge()); + accent(other.getAccent()); + return this; + } + + @java.lang.Override + @JsonSetter("voiceId") + public NameStage voiceId(@NotNull String voiceId) { + this.voiceId = Objects.requireNonNull(voiceId, "voiceId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage accent(String accent) { + this.accent = Optional.ofNullable(accent); + return this; + } + + @java.lang.Override + @JsonSetter(value = "accent", nulls = Nulls.SKIP) + public _FinalStage accent(Optional accent) { + this.accent = accent; + return this; + } + + @java.lang.Override + public _FinalStage age(Map age) { + this.age = Optional.ofNullable(age); + return this; + } + + @java.lang.Override + @JsonSetter(value = "age", nulls = Nulls.SKIP) + public _FinalStage age(Optional> age) { + this.age = age; + return this; + } + + @java.lang.Override + public _FinalStage gender(String gender) { + this.gender = Optional.ofNullable(gender); + return this; + } + + @java.lang.Override + @JsonSetter(value = "gender", nulls = Nulls.SKIP) + public _FinalStage gender(Optional gender) { + this.gender = gender; + return this; + } + + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public _FinalStage publicOwnerId(String publicOwnerId) { + this.publicOwnerId = Optional.ofNullable(publicOwnerId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "publicOwnerId", nulls = Nulls.SKIP) + public _FinalStage publicOwnerId(Optional publicOwnerId) { + this.publicOwnerId = publicOwnerId; + return this; + } + + @java.lang.Override + public VoiceLibraryVoiceResponse build() { + return new VoiceLibraryVoiceResponse( + voiceId, name, publicOwnerId, description, gender, age, accent, additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/VonageCredential.java b/src/main/java/com/vapi/api/types/VonageCredential.java new file mode 100644 index 0000000..7e487c8 --- /dev/null +++ b/src/main/java/com/vapi/api/types/VonageCredential.java @@ -0,0 +1,357 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = VonageCredential.Builder.class) +public final class VonageCredential { + private final String vonageApplicationPrivateKey; + + private final String apiSecret; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final String vonageApplicationId; + + private final String apiKey; + + private final Map additionalProperties; + + private VonageCredential( + String vonageApplicationPrivateKey, + String apiSecret, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + String vonageApplicationId, + String apiKey, + Map additionalProperties) { + this.vonageApplicationPrivateKey = vonageApplicationPrivateKey; + this.apiSecret = apiSecret; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.vonageApplicationId = vonageApplicationId; + this.apiKey = apiKey; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("vonageApplicationPrivateKey") + public String getVonageApplicationPrivateKey() { + return vonageApplicationPrivateKey; + } + + @JsonProperty("provider") + public String getProvider() { + return "vonage"; + } + + /** + * @return This is not returned in the API. + */ + @JsonProperty("apiSecret") + public String getApiSecret() { + return apiSecret; + } + + /** + * @return This is the unique identifier for the credential. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this credential belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the credential was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the assistant was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the Vonage Application ID for the credential. + *

Only relevant for Vonage credentials.

+ */ + @JsonProperty("vonageApplicationId") + public String getVonageApplicationId() { + return vonageApplicationId; + } + + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonageCredential && equalTo((VonageCredential) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(VonageCredential other) { + return vonageApplicationPrivateKey.equals(other.vonageApplicationPrivateKey) + && apiSecret.equals(other.apiSecret) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && vonageApplicationId.equals(other.vonageApplicationId) + && apiKey.equals(other.apiKey); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.vonageApplicationPrivateKey, + this.apiSecret, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.vonageApplicationId, + this.apiKey); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static VonageApplicationPrivateKeyStage builder() { + return new Builder(); + } + + public interface VonageApplicationPrivateKeyStage { + ApiSecretStage vonageApplicationPrivateKey(@NotNull String vonageApplicationPrivateKey); + + Builder from(VonageCredential other); + } + + public interface ApiSecretStage { + IdStage apiSecret(@NotNull String apiSecret); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + VonageApplicationIdStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface VonageApplicationIdStage { + ApiKeyStage vonageApplicationId(@NotNull String vonageApplicationId); + } + + public interface ApiKeyStage { + _FinalStage apiKey(@NotNull String apiKey); + } + + public interface _FinalStage { + VonageCredential build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements VonageApplicationPrivateKeyStage, + ApiSecretStage, + IdStage, + OrgIdStage, + CreatedAtStage, + UpdatedAtStage, + VonageApplicationIdStage, + ApiKeyStage, + _FinalStage { + private String vonageApplicationPrivateKey; + + private String apiSecret; + + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private String vonageApplicationId; + + private String apiKey; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(VonageCredential other) { + vonageApplicationPrivateKey(other.getVonageApplicationPrivateKey()); + apiSecret(other.getApiSecret()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + vonageApplicationId(other.getVonageApplicationId()); + apiKey(other.getApiKey()); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("vonageApplicationPrivateKey") + public ApiSecretStage vonageApplicationPrivateKey(@NotNull String vonageApplicationPrivateKey) { + this.vonageApplicationPrivateKey = + Objects.requireNonNull(vonageApplicationPrivateKey, "vonageApplicationPrivateKey must not be null"); + return this; + } + + /** + *

This is not returned in the API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("apiSecret") + public IdStage apiSecret(@NotNull String apiSecret) { + this.apiSecret = Objects.requireNonNull(apiSecret, "apiSecret must not be null"); + return this; + } + + /** + *

This is the unique identifier for the credential.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this credential belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the credential was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the assistant was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public VonageApplicationIdStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the Vonage Application ID for the credential.

+ *

Only relevant for Vonage credentials.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("vonageApplicationId") + public ApiKeyStage vonageApplicationId(@NotNull String vonageApplicationId) { + this.vonageApplicationId = + Objects.requireNonNull(vonageApplicationId, "vonageApplicationId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("apiKey") + public _FinalStage apiKey(@NotNull String apiKey) { + this.apiKey = Objects.requireNonNull(apiKey, "apiKey must not be null"); + return this; + } + + @java.lang.Override + public VonageCredential build() { + return new VonageCredential( + vonageApplicationPrivateKey, + apiSecret, + id, + orgId, + createdAt, + updatedAt, + vonageApplicationId, + apiKey, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/VonagePhoneNumber.java b/src/main/java/com/vapi/api/types/VonagePhoneNumber.java new file mode 100644 index 0000000..6fae672 --- /dev/null +++ b/src/main/java/com/vapi/api/types/VonagePhoneNumber.java @@ -0,0 +1,545 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = VonagePhoneNumber.Builder.class) +public final class VonagePhoneNumber { + private final Optional fallbackDestination; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional name; + + private final Optional assistantId; + + private final Optional squadId; + + private final Optional serverUrl; + + private final Optional serverUrlSecret; + + private final String number; + + private final String credentialId; + + private final Map additionalProperties; + + private VonagePhoneNumber( + Optional fallbackDestination, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional name, + Optional assistantId, + Optional squadId, + Optional serverUrl, + Optional serverUrlSecret, + String number, + String credentialId, + Map additionalProperties) { + this.fallbackDestination = fallbackDestination; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.name = name; + this.assistantId = assistantId; + this.squadId = squadId; + this.serverUrl = serverUrl; + this.serverUrlSecret = serverUrlSecret; + this.number = number; + this.credentialId = credentialId; + this.additionalProperties = additionalProperties; + } + + /** + * @return This is the fallback destination an inbound call will be transferred to if: + *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ */ + @JsonProperty("fallbackDestination") + public Optional getFallbackDestination() { + return fallbackDestination; + } + + /** + * @return This is the unique identifier for the phone number. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the org that this phone number belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the phone number was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the phone number was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the name of the phone number. This is just for your own reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return This is the assistant that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("assistantId") + public Optional getAssistantId() { + return assistantId; + } + + /** + * @return This is the squad that will be used for incoming calls to this phone number. + *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ */ + @JsonProperty("squadId") + public Optional getSquadId() { + return squadId; + } + + /** + * @return This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message. + *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ */ + @JsonProperty("serverUrl") + public Optional getServerUrl() { + return serverUrl; + } + + /** + * @return This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret. + *

Same precedence logic as serverUrl.

+ */ + @JsonProperty("serverUrlSecret") + public Optional getServerUrlSecret() { + return serverUrlSecret; + } + + /** + * @return These are the digits of the phone number you own on your Vonage. + */ + @JsonProperty("number") + public String getNumber() { + return number; + } + + /** + * @return This is the credential that is used to make outgoing calls, and do operations like call transfer and hang up. + */ + @JsonProperty("credentialId") + public String getCredentialId() { + return credentialId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof VonagePhoneNumber && equalTo((VonagePhoneNumber) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(VonagePhoneNumber other) { + return fallbackDestination.equals(other.fallbackDestination) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && name.equals(other.name) + && assistantId.equals(other.assistantId) + && squadId.equals(other.squadId) + && serverUrl.equals(other.serverUrl) + && serverUrlSecret.equals(other.serverUrlSecret) + && number.equals(other.number) + && credentialId.equals(other.credentialId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.fallbackDestination, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.name, + this.assistantId, + this.squadId, + this.serverUrl, + this.serverUrlSecret, + this.number, + this.credentialId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(VonagePhoneNumber other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + NumberStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface NumberStage { + CredentialIdStage number(@NotNull String number); + } + + public interface CredentialIdStage { + _FinalStage credentialId(@NotNull String credentialId); + } + + public interface _FinalStage { + VonagePhoneNumber build(); + + _FinalStage fallbackDestination(Optional fallbackDestination); + + _FinalStage fallbackDestination(VonagePhoneNumberFallbackDestination fallbackDestination); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + + _FinalStage assistantId(Optional assistantId); + + _FinalStage assistantId(String assistantId); + + _FinalStage squadId(Optional squadId); + + _FinalStage squadId(String squadId); + + _FinalStage serverUrl(Optional serverUrl); + + _FinalStage serverUrl(String serverUrl); + + _FinalStage serverUrlSecret(Optional serverUrlSecret); + + _FinalStage serverUrlSecret(String serverUrlSecret); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, + OrgIdStage, + CreatedAtStage, + UpdatedAtStage, + NumberStage, + CredentialIdStage, + _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private String number; + + private String credentialId; + + private Optional serverUrlSecret = Optional.empty(); + + private Optional serverUrl = Optional.empty(); + + private Optional squadId = Optional.empty(); + + private Optional assistantId = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional fallbackDestination = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(VonagePhoneNumber other) { + fallbackDestination(other.getFallbackDestination()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + name(other.getName()); + assistantId(other.getAssistantId()); + squadId(other.getSquadId()); + serverUrl(other.getServerUrl()); + serverUrlSecret(other.getServerUrlSecret()); + number(other.getNumber()); + credentialId(other.getCredentialId()); + return this; + } + + /** + *

This is the unique identifier for the phone number.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the org that this phone number belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the phone number was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the phone number was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public NumberStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

These are the digits of the phone number you own on your Vonage.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("number") + public CredentialIdStage number(@NotNull String number) { + this.number = Objects.requireNonNull(number, "number must not be null"); + return this; + } + + /** + *

This is the credential that is used to make outgoing calls, and do operations like call transfer and hang up.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("credentialId") + public _FinalStage credentialId(@NotNull String credentialId) { + this.credentialId = Objects.requireNonNull(credentialId, "credentialId must not be null"); + return this; + } + + /** + *

This is the secret Vapi will send with every message to your server. It's sent as a header called x-vapi-secret.

+ *

Same precedence logic as serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrlSecret(String serverUrlSecret) { + this.serverUrlSecret = Optional.ofNullable(serverUrlSecret); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrlSecret", nulls = Nulls.SKIP) + public _FinalStage serverUrlSecret(Optional serverUrlSecret) { + this.serverUrlSecret = serverUrlSecret; + return this; + } + + /** + *

This is the server URL where messages will be sent for calls on this number. This includes the assistant-request message.

+ *

You can see the shape of the messages sent in ServerMessage.

+ *

This overrides the org.serverUrl. Order of precedence: tool.server.url > assistant.serverUrl > phoneNumber.serverUrl > org.serverUrl.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage serverUrl(String serverUrl) { + this.serverUrl = Optional.ofNullable(serverUrl); + return this; + } + + @java.lang.Override + @JsonSetter(value = "serverUrl", nulls = Nulls.SKIP) + public _FinalStage serverUrl(Optional serverUrl) { + this.serverUrl = serverUrl; + return this; + } + + /** + *

This is the squad that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage squadId(String squadId) { + this.squadId = Optional.ofNullable(squadId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "squadId", nulls = Nulls.SKIP) + public _FinalStage squadId(Optional squadId) { + this.squadId = squadId; + return this; + } + + /** + *

This is the assistant that will be used for incoming calls to this phone number.

+ *

If neither assistantId nor squadId is set, assistant-request will be sent to your Server URL. Check ServerMessage and ServerMessageResponse for the shape of the message and response that is expected.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assistantId(String assistantId) { + this.assistantId = Optional.ofNullable(assistantId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "assistantId", nulls = Nulls.SKIP) + public _FinalStage assistantId(Optional assistantId) { + this.assistantId = assistantId; + return this; + } + + /** + *

This is the name of the phone number. This is just for your own reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

This is the fallback destination an inbound call will be transferred to if:

+ *
    + *
  1. assistantId is not set
  2. + *
  3. squadId is not set
  4. + *
  5. and, assistant-request message to the serverUrl fails
  6. + *
+ *

If this is not set and above conditions are met, the inbound call is hung up with an error message.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fallbackDestination(VonagePhoneNumberFallbackDestination fallbackDestination) { + this.fallbackDestination = Optional.ofNullable(fallbackDestination); + return this; + } + + @java.lang.Override + @JsonSetter(value = "fallbackDestination", nulls = Nulls.SKIP) + public _FinalStage fallbackDestination(Optional fallbackDestination) { + this.fallbackDestination = fallbackDestination; + return this; + } + + @java.lang.Override + public VonagePhoneNumber build() { + return new VonagePhoneNumber( + fallbackDestination, + id, + orgId, + createdAt, + updatedAt, + name, + assistantId, + squadId, + serverUrl, + serverUrlSecret, + number, + credentialId, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/VonagePhoneNumberFallbackDestination.java b/src/main/java/com/vapi/api/types/VonagePhoneNumberFallbackDestination.java new file mode 100644 index 0000000..a936f61 --- /dev/null +++ b/src/main/java/com/vapi/api/types/VonagePhoneNumberFallbackDestination.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class VonagePhoneNumberFallbackDestination { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private VonagePhoneNumberFallbackDestination(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static VonagePhoneNumberFallbackDestination number(TransferDestinationNumber value) { + return new VonagePhoneNumberFallbackDestination(new NumberValue(value)); + } + + public static VonagePhoneNumberFallbackDestination sip(TransferDestinationSip value) { + return new VonagePhoneNumberFallbackDestination(new SipValue(value)); + } + + public boolean isNumber() { + return value instanceof NumberValue; + } + + public boolean isSip() { + return value instanceof SipValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getNumber() { + if (isNumber()) { + return Optional.of(((NumberValue) value).value); + } + return Optional.empty(); + } + + public Optional getSip() { + if (isSip()) { + return Optional.of(((SipValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitNumber(TransferDestinationNumber number); + + T visitSip(TransferDestinationSip sip); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(NumberValue.class), @JsonSubTypes.Type(SipValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("number") + private static final class NumberValue implements Value { + @JsonUnwrapped + private TransferDestinationNumber value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private NumberValue() {} + + private NumberValue(TransferDestinationNumber value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitNumber(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberValue && equalTo((NumberValue) other); + } + + private boolean equalTo(NumberValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "VonagePhoneNumberFallbackDestination{" + "value: " + value + "}"; + } + } + + @JsonTypeName("sip") + private static final class SipValue implements Value { + @JsonUnwrapped + private TransferDestinationSip value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private SipValue() {} + + private SipValue(TransferDestinationSip value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitSip(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SipValue && equalTo((SipValue) other); + } + + private boolean equalTo(SipValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "VonagePhoneNumberFallbackDestination{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "VonagePhoneNumberFallbackDestination{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/WorkflowBlock.java b/src/main/java/com/vapi/api/types/WorkflowBlock.java new file mode 100644 index 0000000..fe01684 --- /dev/null +++ b/src/main/java/com/vapi/api/types/WorkflowBlock.java @@ -0,0 +1,444 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.vapi.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = WorkflowBlock.Builder.class) +public final class WorkflowBlock { + private final Optional> messages; + + private final Optional inputSchema; + + private final Optional outputSchema; + + private final Optional> steps; + + private final String id; + + private final String orgId; + + private final OffsetDateTime createdAt; + + private final OffsetDateTime updatedAt; + + private final Optional name; + + private final Map additionalProperties; + + private WorkflowBlock( + Optional> messages, + Optional inputSchema, + Optional outputSchema, + Optional> steps, + String id, + String orgId, + OffsetDateTime createdAt, + OffsetDateTime updatedAt, + Optional name, + Map additionalProperties) { + this.messages = messages; + this.inputSchema = inputSchema; + this.outputSchema = outputSchema; + this.steps = steps; + this.id = id; + this.orgId = orgId; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return These are the pre-configured messages that will be spoken to the user while the block is running. + */ + @JsonProperty("messages") + public Optional> getMessages() { + return messages; + } + + /** + * @return This is the input schema for the block. This is the input the block needs to run. It's given to the block as steps[0].input + *

These are accessible as variables:

+ *
    + *
  • ({{input.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.input.propertyName}}) in context of the workflow
  • + *
+ */ + @JsonProperty("inputSchema") + public Optional getInputSchema() { + return inputSchema; + } + + /** + * @return This is the output schema for the block. This is the output the block will return to the workflow ({{stepName.output}}). + *

These are accessible as variables:

+ *
    + *
  • ({{output.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
  • + *
  • ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2)
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ */ + @JsonProperty("outputSchema") + public Optional getOutputSchema() { + return outputSchema; + } + + /** + * @return These are the steps in the workflow. + */ + @JsonProperty("steps") + public Optional> getSteps() { + return steps; + } + + /** + * @return This is the unique identifier for the block. + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return This is the unique identifier for the organization that this block belongs to. + */ + @JsonProperty("orgId") + public String getOrgId() { + return orgId; + } + + /** + * @return This is the ISO 8601 date-time string of when the block was created. + */ + @JsonProperty("createdAt") + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + /** + * @return This is the ISO 8601 date-time string of when the block was last updated. + */ + @JsonProperty("updatedAt") + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + /** + * @return This is the name of the block. This is just for your reference. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkflowBlock && equalTo((WorkflowBlock) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(WorkflowBlock other) { + return messages.equals(other.messages) + && inputSchema.equals(other.inputSchema) + && outputSchema.equals(other.outputSchema) + && steps.equals(other.steps) + && id.equals(other.id) + && orgId.equals(other.orgId) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.messages, + this.inputSchema, + this.outputSchema, + this.steps, + this.id, + this.orgId, + this.createdAt, + this.updatedAt, + this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + OrgIdStage id(@NotNull String id); + + Builder from(WorkflowBlock other); + } + + public interface OrgIdStage { + CreatedAtStage orgId(@NotNull String orgId); + } + + public interface CreatedAtStage { + UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); + } + + public interface UpdatedAtStage { + _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); + } + + public interface _FinalStage { + WorkflowBlock build(); + + _FinalStage messages(Optional> messages); + + _FinalStage messages(List messages); + + _FinalStage inputSchema(Optional inputSchema); + + _FinalStage inputSchema(JsonSchema inputSchema); + + _FinalStage outputSchema(Optional outputSchema); + + _FinalStage outputSchema(JsonSchema outputSchema); + + _FinalStage steps(Optional> steps); + + _FinalStage steps(List steps); + + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, OrgIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String orgId; + + private OffsetDateTime createdAt; + + private OffsetDateTime updatedAt; + + private Optional name = Optional.empty(); + + private Optional> steps = Optional.empty(); + + private Optional outputSchema = Optional.empty(); + + private Optional inputSchema = Optional.empty(); + + private Optional> messages = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(WorkflowBlock other) { + messages(other.getMessages()); + inputSchema(other.getInputSchema()); + outputSchema(other.getOutputSchema()); + steps(other.getSteps()); + id(other.getId()); + orgId(other.getOrgId()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + name(other.getName()); + return this; + } + + /** + *

This is the unique identifier for the block.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OrgIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

This is the unique identifier for the organization that this block belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("orgId") + public CreatedAtStage orgId(@NotNull String orgId) { + this.orgId = Objects.requireNonNull(orgId, "orgId must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the block was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("createdAt") + public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { + this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); + return this; + } + + /** + *

This is the ISO 8601 date-time string of when the block was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updatedAt") + public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { + this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); + return this; + } + + /** + *

This is the name of the block. This is just for your reference.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

These are the steps in the workflow.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage steps(List steps) { + this.steps = Optional.ofNullable(steps); + return this; + } + + @java.lang.Override + @JsonSetter(value = "steps", nulls = Nulls.SKIP) + public _FinalStage steps(Optional> steps) { + this.steps = steps; + return this; + } + + /** + *

This is the output schema for the block. This is the output the block will return to the workflow ({{stepName.output}}).

+ *

These are accessible as variables:

+ *
    + *
  • ({{output.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.output.propertyName}}) in context of the workflow (read caveat #1)
  • + *
  • ({{blockName.output.propertyName}}) in context of the workflow (read caveat #2)
  • + *
+ *

Caveats:

+ *
    + *
  1. a workflow can execute a step multiple times. example, if a loop is used in the graph. {{stepName.output.propertyName}} will reference the latest usage of the step.
  2. + *
  3. a workflow can execute a block multiple times. example, if a step is called multiple times or if a block is used in multiple steps. {{blockName.output.propertyName}} will reference the latest usage of the block. this liquid variable is just provided for convenience when creating blocks outside of a workflow with steps.
  4. + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage outputSchema(JsonSchema outputSchema) { + this.outputSchema = Optional.ofNullable(outputSchema); + return this; + } + + @java.lang.Override + @JsonSetter(value = "outputSchema", nulls = Nulls.SKIP) + public _FinalStage outputSchema(Optional outputSchema) { + this.outputSchema = outputSchema; + return this; + } + + /** + *

This is the input schema for the block. This is the input the block needs to run. It's given to the block as steps[0].input

+ *

These are accessible as variables:

+ *
    + *
  • ({{input.propertyName}}) in context of the block execution (step)
  • + *
  • ({{stepName.input.propertyName}}) in context of the workflow
  • + *
+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage inputSchema(JsonSchema inputSchema) { + this.inputSchema = Optional.ofNullable(inputSchema); + return this; + } + + @java.lang.Override + @JsonSetter(value = "inputSchema", nulls = Nulls.SKIP) + public _FinalStage inputSchema(Optional inputSchema) { + this.inputSchema = inputSchema; + return this; + } + + /** + *

These are the pre-configured messages that will be spoken to the user while the block is running.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage messages(List messages) { + this.messages = Optional.ofNullable(messages); + return this; + } + + @java.lang.Override + @JsonSetter(value = "messages", nulls = Nulls.SKIP) + public _FinalStage messages(Optional> messages) { + this.messages = messages; + return this; + } + + @java.lang.Override + public WorkflowBlock build() { + return new WorkflowBlock( + messages, + inputSchema, + outputSchema, + steps, + id, + orgId, + createdAt, + updatedAt, + name, + additionalProperties); + } + } +} diff --git a/src/main/java/com/vapi/api/types/WorkflowBlockMessagesItem.java b/src/main/java/com/vapi/api/types/WorkflowBlockMessagesItem.java new file mode 100644 index 0000000..3676d14 --- /dev/null +++ b/src/main/java/com/vapi/api/types/WorkflowBlockMessagesItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class WorkflowBlockMessagesItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private WorkflowBlockMessagesItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static WorkflowBlockMessagesItem blockStart(BlockStartMessage value) { + return new WorkflowBlockMessagesItem(new BlockStartValue(value)); + } + + public static WorkflowBlockMessagesItem blockComplete(BlockCompleteMessage value) { + return new WorkflowBlockMessagesItem(new BlockCompleteValue(value)); + } + + public boolean isBlockStart() { + return value instanceof BlockStartValue; + } + + public boolean isBlockComplete() { + return value instanceof BlockCompleteValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getBlockStart() { + if (isBlockStart()) { + return Optional.of(((BlockStartValue) value).value); + } + return Optional.empty(); + } + + public Optional getBlockComplete() { + if (isBlockComplete()) { + return Optional.of(((BlockCompleteValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitBlockStart(BlockStartMessage blockStart); + + T visitBlockComplete(BlockCompleteMessage blockComplete); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(BlockStartValue.class), @JsonSubTypes.Type(BlockCompleteValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("block-start") + private static final class BlockStartValue implements Value { + @JsonUnwrapped + private BlockStartMessage value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BlockStartValue() {} + + private BlockStartValue(BlockStartMessage value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBlockStart(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockStartValue && equalTo((BlockStartValue) other); + } + + private boolean equalTo(BlockStartValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "WorkflowBlockMessagesItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("block-complete") + private static final class BlockCompleteValue implements Value { + @JsonUnwrapped + private BlockCompleteMessage value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private BlockCompleteValue() {} + + private BlockCompleteValue(BlockCompleteMessage value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitBlockComplete(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BlockCompleteValue && equalTo((BlockCompleteValue) other); + } + + private boolean equalTo(BlockCompleteValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "WorkflowBlockMessagesItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "WorkflowBlockMessagesItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/vapi/api/types/WorkflowBlockStepsItem.java b/src/main/java/com/vapi/api/types/WorkflowBlockStepsItem.java new file mode 100644 index 0000000..a5487ab --- /dev/null +++ b/src/main/java/com/vapi/api/types/WorkflowBlockStepsItem.java @@ -0,0 +1,200 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +public final class WorkflowBlockStepsItem { + private final Value value; + + @JsonCreator(mode = JsonCreator.Mode.DELEGATING) + private WorkflowBlockStepsItem(Value value) { + this.value = value; + } + + public T visit(Visitor visitor) { + return value.visit(visitor); + } + + public static WorkflowBlockStepsItem handoff(HandoffStep value) { + return new WorkflowBlockStepsItem(new HandoffValue(value)); + } + + public static WorkflowBlockStepsItem callback(CallbackStep value) { + return new WorkflowBlockStepsItem(new CallbackValue(value)); + } + + public boolean isHandoff() { + return value instanceof HandoffValue; + } + + public boolean isCallback() { + return value instanceof CallbackValue; + } + + public boolean _isUnknown() { + return value instanceof _UnknownValue; + } + + public Optional getHandoff() { + if (isHandoff()) { + return Optional.of(((HandoffValue) value).value); + } + return Optional.empty(); + } + + public Optional getCallback() { + if (isCallback()) { + return Optional.of(((CallbackValue) value).value); + } + return Optional.empty(); + } + + public Optional _getUnknown() { + if (_isUnknown()) { + return Optional.of(((_UnknownValue) value).value); + } + return Optional.empty(); + } + + @JsonValue + private Value getValue() { + return this.value; + } + + public interface Visitor { + T visitHandoff(HandoffStep handoff); + + T visitCallback(CallbackStep callback); + + T _visitUnknown(Object unknownType); + } + + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true, defaultImpl = _UnknownValue.class) + @JsonSubTypes({@JsonSubTypes.Type(HandoffValue.class), @JsonSubTypes.Type(CallbackValue.class)}) + @JsonIgnoreProperties(ignoreUnknown = true) + private interface Value { + T visit(Visitor visitor); + } + + @JsonTypeName("handoff") + private static final class HandoffValue implements Value { + @JsonUnwrapped + private HandoffStep value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private HandoffValue() {} + + private HandoffValue(HandoffStep value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitHandoff(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof HandoffValue && equalTo((HandoffValue) other); + } + + private boolean equalTo(HandoffValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "WorkflowBlockStepsItem{" + "value: " + value + "}"; + } + } + + @JsonTypeName("callback") + private static final class CallbackValue implements Value { + @JsonUnwrapped + private CallbackStep value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private CallbackValue() {} + + private CallbackValue(CallbackStep value) { + this.value = value; + } + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor.visitCallback(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CallbackValue && equalTo((CallbackValue) other); + } + + private boolean equalTo(CallbackValue other) { + return value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.value); + } + + @java.lang.Override + public String toString() { + return "WorkflowBlockStepsItem{" + "value: " + value + "}"; + } + } + + private static final class _UnknownValue implements Value { + private String type; + + @JsonValue + private Object value; + + @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) + private _UnknownValue(@JsonProperty("value") Object value) {} + + @java.lang.Override + public T visit(Visitor visitor) { + return visitor._visitUnknown(value); + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof _UnknownValue && equalTo((_UnknownValue) other); + } + + private boolean equalTo(_UnknownValue other) { + return type.equals(other.type) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @java.lang.Override + public String toString() { + return "WorkflowBlockStepsItem{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/test/java/com/vapi/api/TestClient.java b/src/test/java/com/vapi/api/TestClient.java new file mode 100644 index 0000000..c7254f2 --- /dev/null +++ b/src/test/java/com/vapi/api/TestClient.java @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.vapi.api; + +public final class TestClient { + public void test() { + // Add tests here and mark this file in .fernignore + assert true; + } +}